Page 1 of 1

XSLT debugging current-group

Posted: Fri Aug 01, 2008 12:46 pm
by PaulHermans
Is it possible to see the sequence of items belonging the current-group() in the debugger?


Regards,

Paul

Re: XSLT debugging current-group

Posted: Fri Aug 01, 2008 4:24 pm
by sorin_ristache
Hello,

Yes, it is possible if the transformation engine does not optimize the body of the xsl:for-each-group so that the value of current-group() is not computed. For example with Saxon 9 you can declare a variable that requests computing the value of the function in the body of the xsl:for-each-group:

Code: Select all

 <xsl:variable name="cg" select="current-group()"/>
and you use the value of the variable in other XSLT instruction in the body of the xsl:for-each-group:

Code: Select all

  <group>
<xsl:value-of select="$cg"/>
</group>
In the Variables view you can see the value of current-group() as the value of cg. If you do not use the variable cg in an instruction like xsl:value-of the transformation engine may not compute the variable due to optimizations. The optimizations depend on the transformation engine.


Regards,
Sorin