View RSS Feed

My Java Tips

XSLT Conditions

Rate this Entry
by , 05-25-2011 at 10:30 AM (2636 Views)
Consider the scenario: You have xml data and you need to filter some data out. You may do that in Java but its open a good idea to keep the logic separate in XSLT filters.

if-then-else condition is done the following way in XSLT:

Java Code:
  <xsl:when test="...">
  <xsl:when test="...">
If you only want a simple if condition, then you should use the following:

Java Code:
<xsl:if test="{$x && $y && $z}">
Logical AND amd OR are always helpful. The above condition reads like: if the value of "x" exists and the value of "y" exists and the value of "z" then do something.

Submit "XSLT Conditions" to Facebook Submit "XSLT Conditions" to Digg Submit "XSLT Conditions" to Submit "XSLT Conditions" to StumbleUpon Submit "XSLT Conditions" to Google

Tags: xslt Add / Edit Tags