[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] Numbering - how to exclude "cousin" elements?


Subject: RE: [xsl] Numbering - how to exclude "cousin" elements?
From: "Glen Little" <glittle@xxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 17 Jun 2004 16:15:58 -0600

Thanks to Josh and Charles for your answers. Both strategies worked for the
sample given.

As usual, the real code is more complex. In practice, I needed to be able to
put the  Standalone="true"  on a few other levels as well. What I've now
started to use is similar to this:
<xsl:template match="Sentence">
  <xsl:variable name="StartFrom">
    <xsl:value-of select="generate-id(ancestor::*[@Standalone='true'][1])"/>
  </xsl:variable>
  <xsl:copy>
    <xsl:copy-of select="@*"/>
    <xsl:attribute name="Number">
      <xsl:number
count="Sentence[generate-id(ancestor::*[@Standalone='true'][1])=$
StartFrom]" level="any"/>
    </xsl:attribute>
    <xsl:apply-templates/>
  </xsl:copy>
</xsl:template>

Thanks again!
Glen




Current Thread