Subject: RE: Sort of footnote nodes, processing and counting
From: "Trevor Nicholls" <trevor@xxxxxxxxxxxxxxxxxx>
Date: Tue, 28 Feb 2006 00:55:54 +1300
|
So as not to leave that last problem hanging, this stylesheet fragment works
in Saxon and overflows the stack in XMLSpy:
<xsl:template match="footnote[@level='document']">
<sup><xsl:number level="any" from="document" format="1"
count="footnote[@level=current()/@level]"/></sup>
</xsl:template>
<xsl:template match="footnote[@level='section']">
<sup><xsl:number level="any" from="section" format="a"
count="footnote[@level=current()/@level]"/></sup>
</xsl:template>
<xsl:template match="footnote[@level='table']">
<sup><xsl:number level="any" from="table" format="i"
count="footnote[@level=current()/@level]"/></sup>
</xsl:template>
<xsl:template match="footnote" mode="footnote">
<p><xsl:apply-templates select="." />
<xsl:apply-templates /></p>
</xsl:template>
However cloning all the footnote[@level..] templates with another 'mode'
allows XMLSpy to run:
<xsl:template match="footnote[@level='document']">
<sup><xsl:number level="any" from="document" format="1"
count="footnote[@level=current()/@level]"/></sup>
</xsl:template>
<xsl:template match="footnote[@level='section']">
<sup><xsl:number level="any" from="section" format="a"
count="footnote[@level=current()/@level]"/></sup>
</xsl:template>
<xsl:template match="footnote[@level='table']">
<sup><xsl:number level="any" from="table" format="i"
count="footnote[@level=current()/@level]"/></sup>
</xsl:template>
<xsl:template match="footnote" mode="footnote">
<p><xsl:apply-templates select="." mode="dup"/>
<xsl:apply-templates /></p>
</xsl:template>
<xsl:template match="footnote[@level='document']" mode="dup">
<sup><xsl:number level="any" from="document" format="1"
count="footnote[@level=current()/@level]"/></sup>
</xsl:template>
<xsl:template match="footnote[@level='section']" mode="dup">
<sup><xsl:number level="any" from="section" format="a"
count="footnote[@level=current()/@level]"/></sup>
</xsl:template>
<xsl:template match="footnote[@level='table']" mode="dup">
<sup><xsl:number level="any" from="table" format="i"
count="footnote[@level=current()/@level]"/></sup>
</xsl:template>
Is the conclusion that XMLSpy (this is 2006 Home Edition) remembers a mode
and passes it through to descendant templates justified? And (if so) is this
compliant behaviour?
Cheers
Trevor
-----Original Message-----
From: Trevor Nicholls [mailto:trevor@xxxxxxxxxxxxxxxxxx]
Sent: Tuesday, 28 February 2006 12:34 a.m.
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE: Sort of footnote nodes, processing and counting
Thank you Dr Kay. Somewhat abashed, I must confess that I am testing this
project in two environments: XMLSpy 2006 on my laptop and Saxon on the
repository/build server.
Saxon does *not* stack overflow on
----
<xsl:template match="footnote" mode="footnote">
<p><xsl:apply-templates select="." /> <!-- LINE 2 -->
<xsl:apply-templates />
</p>
</xsl:template>
----
but XMLSpy does.
|