Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I tell if a variable in xslt is greater than another

Tags:

Each of these variables has an integer value. But this syntax is not valid for some reason:

<xsl:when test="$nextAnswerListItemPos < $nextQuestionStemPos" > 
like image 455
joe Avatar asked Nov 25 '08 15:11

joe


People also ask

How do you use greater than and less than in XSLT?

You're always safe using &gt; here, although some XSLT processors process the greater-than sign correctly if you use > instead. If you need to use the less-than operator ( < ), you'll have to use the &lt; entity.

What is difference between Param and variable in XSLT?

The difference is that the value of an xsl:param could be set outside the context in which it is declared.

What is Number () in XSLT?

Definition and Usage. The <xsl:number> element is used to determine the integer position of the current node in the source. It is also used to format a number.


2 Answers

You have to use &lt; instead of < and &gt; instead of >, because those are reserved characters.

like image 153
Julien Oster Avatar answered Oct 04 '22 06:10

Julien Oster


Also, in XSLT 2.0, you can use the operators "gt" (greater than), "lt" (less than), and "eq" (equal). Using these instead of the entities makes your code a bit cleaner.

like image 39
James Sulak Avatar answered Oct 04 '22 07:10

James Sulak