how to do an if like statement or equivalent in XSLT -
is possible write out xml based on "if" "like" statement or equivalent of in xslt?
i have element named "cust_code" if element starts "he" want write out, otherwise jump next.
is possible?
if
statements exist in xslt.
<xsl:if test="..."> ... </xsl:if>
but simple if
, no alternative.
if want equivalent if ... else ...
or switch ... case ...
, need use following:
<xsl:choose> <xsl:when test="..."> </xsl:when> <xsl:otherwise> </xsl:otherwise> </xsl:choose>
you can have many when
cases necessary.
links: w3school - if , w3school - choose.
as having element starting specific string, @ function starts-with
. can find example in this answer (just omit not
main answer, tests find strings not starting particular string). can @ this answer more information.
Comments
Post a Comment