XSLT debugging current-group

Having trouble installing Oxygen? Got a bug to report? Post it all here.
PaulHermans
Posts: 82
Joined: Sat Jan 13, 2007 5:39 pm
Location: Belgium

XSLT debugging current-group

Post by PaulHermans »

Is it possible to see the sequence of items belonging the current-group() in the debugger?


Regards,

Paul
Paul
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: XSLT debugging current-group

Post 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
Post Reply