Ant if and unless: Is it AND or OR condition? - if-statement

I have something like this:
<target name="X" if="A" unless="B">...</target>
Now I need to understand how is this condition evaluated.
Is it:
if (A AND NOT B)
Or is it:
if (A OR NOT B)
Thanks!

I accept the comment of martin clayton as an answer:
A AND NOT B. See execute Ant task if TWO conditions are met

Related

Jelly script <j:if> comparison of two strings

All,
Simply, I need to compare two strings within a jelly script and if they are not the same, I want to update one string with the other value. Simply, I'd like something like this:
<j:if test="${currentTestName} != ${trTest_Name_Pass}">
<j:set var="currentTestName" value="${trTest_Name_Pass}"/>
</j:if>
I've tried various test conditions such as
<j:if test="!( ${currentTestName.equals('${trTest_Name_Pass}')} )">
<j:set var="currentTestName" value="${trTest_Name_Pass}"/>
</j:if>
and some other combinations, but I'm stymied to see how to compare the strings. I've done a fair amount of searching, but have not hit on a solution. Maybe Jelly does not support this. In any case, apologies if this has been addressed elsewhere, but I seemed to have missed it, if it was.
Thanks in advance for any thoughts. -- JC
You should fix the syntax of the Jelly if tag to:
<j:if test="${currentTestName != trTest_Name_Pass}">
Or to:
<j:if test="${!currentTestName.equals(trTest_Name_Pass)}">

cfif statement with no expression or conditionals

Took over some code and I found this logic:
<cfif FALSE>
execute this code
<cfelse>
execute this
</cfif>
There is no conditional or expresssion for the IF statement. Just hanging out there as 'FALSE'. What is this statement evaluating then? OR What is the default expression of a cfif statement?
That example will always run the "execute this" bit (the cfelse). The "execute this code" bit will never run. Looks like an odd way of preventing a chunk of old code from running. The "execute this code" bit could've just been commented-out or removed (and thus no need for the cfif/cfelse tags).

How to write XSLT test condition with two functions

I want to test the input with 2 conditions.
I tried with below statement,
<xsl:when test="(string-lenght(/ns0:PostalCode) < 9) and (string-lenght(/ns0:InoutCode/ns0:PostalCode) > 5)">
but when I am testing the service it's getting below error
The XPath expression failed to execute; the reason was: javax.xml.transform.TransformerException.
Please help me on this issue. How write exact condition?
Do two things:
(a) check the spelling of your function names
(b) find out why you aren't getting any proper diagnostics. You're either using an XPath engine with particularly bad diagnostics, or you aren't running it properly.

How to remove SVN history from java files?

I have various projects that had files with SVN history in them. I recently moved those projects to a Mercurial repository so now that history within the file is useless. Is there a way to remove those which is not by hand?
Here's an example:
/*
* $Rev:x$
* $LastChangedDate:x$
* $LastChangedBy:x$
*/
Where x is a value in the files. I assume some sort of regex would help. Any idea?
Edit:
This is the working answer:
<target name="remove-svn-history">
<replaceregexp byline="false" match="\A/\*.*?\*/" replace="">
<fileset dir="src" includes="**/*.java"/>
</replaceregexp>
</target>
Assuming that's at the beginning of the file, you could match it with the following regex:
\A/\*.*?\*/

Set dynamic variabe in the Datapower context

My requirement is to set some dynamic variables in a for loop to the datapower context something like :
<dp:set-variable name="'var://context/txn-info/appErrorInd[$i+1]'"
value="'yes'" />
The variable $i will keep on changing. The above code isn't working. Can somebody give me a solution?
Use:
<dp:set-variable name="'var:{//context/txn-info/appErrorInd[$i+1]}'"
value="'yes'" />
The above is a mechanical correction of the provided code. Most likely it contains another, more subtle error. To correct this error, too, use:
<dp:set-variable name="'var:{(//context/txn-info/appErrorInd)[$i+1]}'"
value="'yes'" />
Explanation:
Use of AVT.
The [] operator has a higher precedence than the // pseudo-operator. To override this one needs to use explicitly brackets.