jxom else if (google search)
Google helps with many things but with retrospective support.
Probably guy's trying to build a nested if then else jxom elements.
We expected this and have defined a function t:generate-if-statement() in java-optimizer.xslt.
Its signature:
<!-- Generates if/then/else if ... statements. $closure - a series of conditions and blocks. $index - current index. $result - collected result. Returns if/then/else if ... statements. --> <xsl:function name="t:generate-if-statement" as="element()"> <xsl:param name="closure" as="element()*"/> <xsl:param name="index" as="xs:integer"/> <xsl:param name="result" as="element()?"/>
Usage is like this:
<!-- Generate a sequence of pairs: (condition, scope). --> <xsl:variable name="branches" as="element()+"> <xsl:for-each select="..."> <!-- Generate condition. --> <scope> <!-- Generate statemetns. --> </scope> </xsl:for-each> </xsl:variable> <xsl:variable name="else" as="element()?"> <!-- Generate final else, if any. --> </xsl:variable> <!-- This generates if statement. --> <xsl:sequence select="t:generate-if-statement($branches, count($branches) - 1, $else)"/>
P.S. By the way, we like that someone is looking into jxom.
Remember Me
a@href@title, b, blockquote@cite, em, i, strike, strong, sub, super, u