Subject: Re: [xsl] grouping, xslt 2.0 From: Abel Braaksma <abel.online@xxxxxxxxx> Date: Wed, 04 Apr 2007 11:34:51 +0200 |
In an XSLT pattern, current() refers to the node you are trying to match. So the pattern
group-starting-with="*[name() = translate(name(current()),'1234','2345')]">
is wrong. Try assigning the result of the translate() to a variable first.
Thanks. (The hint in XSLT 2.0, 3Ed, p298 is wrong then).
Using <xsl:template match="*[starts-with(name(),'h')]">
<xsl:variable name="tag" select="translate(name(current()),'1234','2345')"/>
<xsl:message>
Match on <xsl:value-of select="name()"/>
Population is <xsl:value-of select="count(current-group())"/>
next is <xsl:value-of select="$tag"/>
</xsl:message>
<section level="{substring-after(name(),'h')}">
<head><xsl:apply-templates/></head>
<xsl:for-each-group select="current-group() except ."
group-starting-with="*[name() = $tag]">
<xsl:apply-templates select="current-group()"/>
</xsl:for-each-group>
</section>
</xsl:template>
Still doesn't hack it though.
It seems to handle the lower levels,
but not something like h3
h3
h2
I.e. 'rising' levels which should be legitimate in the input I'm using.
I'll try some stuff from XSLT 1.0
Cheers, -- Abel
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] grouping, xslt 2.0, Michael Kay | Thread | [xsl] Nesting xsl:call-template, Winchel 'Todd' Vince |
Re: [xsl] Re: xsl-list Digest 4 Apr, Abel Braaksma | Date | Re: [xsl] Xsl:variable content shou, Ronan Klyne |
Month |