Reputation: 34628
There is a question with a similar title, but an entirely different question body: How to increment a XSL integer variable
I get a parameter $level
passed to a template and want to apply templates on $level + 1
, while $level
is guaranteed to always be a strictly positive integer. I have this computation right now, but it seems awful. Ther's got to be a better way:
<xsl:with-param name="level" select="ceiling(number(concat($level,'.9')))" />
This works, but I was wondering if you could directly use xpath:sum direcly, but I struggle because the literal 1
is not a node on its own.
So, is there a better expression for the ceiling(number(concat($level,'.9')))
part?
Upvotes: 2
Views: 567
Reputation: 243449
<xsl:with-param name="level" select="ceiling(number(concat($level,'.9')))" />
Just use:
<xsl:with-param name="level" select="$level+1"/>
Upvotes: 2