Re: [xsl] foreach, preceding-sibling::node() and following-sibling::node()

Subject: Re: [xsl] foreach, preceding-sibling::node() and following-sibling::node()
From: Ragulf Pickaxe <ragulf.pickaxe@xxxxxxxxx>
Date: Wed, 26 Oct 2005 15:34:05 +0200
I am not sure what you want either.

For the examples of your input and output the following three
templates should work:

<xsl:template match="abs">
  <xsl:apply-templates/>
</xsl:template>

<xsl:template match="idlink">
  <xsl:variable name="urlnumber" select="count(preceding::idlink)+1"/>
  <a href="url{$urlnumber}"><xsl:value-of select="."/></a>
</xsl:template>

<xsl:template match="i|b|u|em"> <!-- And more elements -->
  <xsl:copy>
    <xsl:apply-templates/>
  </xsl:copy>

<!-- This template is not needed as this is the same as the default
template for text nodes, but is added for clarity: -->
<xsl:template match="text()">
  <xsl:value-of select="."/>
</xsl:template>

Is this what you need?

Regards,
Ragulf Pickaxe :-)

On 10/26/05, David Carlisle <davidc@xxxxxxxxx> wrote:
>
>
> > Actually, I do want the content between the two idlinks and, that's where
> > I'm stuck. This is what I need:
> > Xml input file:

Current Thread