[xsl] select="current-group() except someElement"

Subject: [xsl] select="current-group() except someElement"
From: Norbert Heidbrink <nh@xxxxxxxx>
Date: Fri, 7 Sep 2012 18:07:23 +0200
Hi there,

I'm afraid, I am missing a point on "except" used in combination with 
"current-group()".
I do not understand why my solution does not work.
Could anybody give me a hint, please?



XML:
<line>Part_1<tab />Part_2a <foo /> Part_2b<tab />Part_3</line>

Desired result of transformation:
G1: Part_1
G2: Part_2a  -FOO-  Part_2b
G3: Part_3

Meaning:
Get hold of the nodes that are separated by <tab> and forget about the 
<tab> itself.


<xsl:apply-templates select="current-group()[not (self::tab)]" />
does the job.
But
<xsl:apply-templates select="current-group() except tab" />
does not work.
Why? Where is my mistake?



XSL: (Using Saxon 9HE)

<xsl:template match="line">
  <xsl:for-each-group select="node()" group-ending-with="tab">
    <xsl:text>&#xA;G</xsl:text><xsl:value-of select="position()" 
/><xsl:text>: </xsl:text>
    <xsl:apply-templates select="current-group() except tab" />
<!-- the following does work:
    <xsl:apply-templates select="current-group()[not (self::tab)]" />
-->
  </xsl:for-each-group>
</xsl:template>

<xsl:template match="tab">
  <xsl:text>TAB</xsl:text>
</xsl:template>

<xsl:template match="foo">
  <xsl:text>FOO</xsl:text>
</xsl:template>



Thanks in advance,
Norbert

Current Thread