gregs

helping me remember what I figure out

XSLT conditional statements

| 0 comments

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

Required fields are marked *.

*