xsl-list
[Top] [All Lists]

RE: Numbering - how to exclude "cousin" elements?

2004-06-17 15:15:58
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::*[(_at_)Standalone='true'][1])"/>
  </xsl:variable>
  <xsl:copy>
    <xsl:copy-of select="@*"/>
    <xsl:attribute name="Number">
      <xsl:number
count="Sentence[generate-id(ancestor::*[(_at_)Standalone='true'][1])=$
StartFrom]" level="any"/>
    </xsl:attribute>
    <xsl:apply-templates/>
  </xsl:copy>
</xsl:template>

Thanks again!
Glen




<Prev in Thread] Current Thread [Next in Thread>