gregs

XSLT conditional statements

by gregs on Aug.23, 2005, under Uncategorized

One of the other completely new aspects of my job has been working with xmlHTTPRequest and XML/XSL transformation. And here are a few things that I learned during my last project: you can use conditional statements. W3schools proved very helpful in getting to grips with this.

You can do if like statements:

XML:
  1. <xsl:if test="expression">
  2. Do something
  3. </xsl:if>

And if/else statements:

XML:
  1. <xsl:choose>
  2. <xsl:when test="expression">
  3. Do something
  4. </xsl:when>
  5. <xsl :o therwise>
  6. Do something else
  7. </xsl :o therwise>
  8. </xsl:choose>

The test expressions can be made up of: "=", "and", "<", "& amp;gt;" and probably a whole lot more, but I haven't come across any other ones yet.


Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!