xsl-list
[Top] [All Lists]

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

2005-10-26 06:34:05
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(_at_)nag(_dot_)co(_dot_)uk> 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:

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--