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[(_at_)level='document']">
<sup><xsl:number level="any" from="document" format="1"
count="footnote[(_at_)level=current()/@level]"/></sup>
</xsl:template>
<xsl:template match="footnote[(_at_)level='section']">
<sup><xsl:number level="any" from="section" format="a"
count="footnote[(_at_)level=current()/@level]"/></sup>
</xsl:template>
<xsl:template match="footnote[(_at_)level='table']">
<sup><xsl:number level="any" from="table" format="i"
count="footnote[(_at_)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[(_at_)level(_dot_)(_dot_)] templates with
another 'mode'
allows XMLSpy to run:
<xsl:template match="footnote[(_at_)level='document']">
<sup><xsl:number level="any" from="document" format="1"
count="footnote[(_at_)level=current()/@level]"/></sup>
</xsl:template>
<xsl:template match="footnote[(_at_)level='section']">
<sup><xsl:number level="any" from="section" format="a"
count="footnote[(_at_)level=current()/@level]"/></sup>
</xsl:template>
<xsl:template match="footnote[(_at_)level='table']">
<sup><xsl:number level="any" from="table" format="i"
count="footnote[(_at_)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[(_at_)level='document']" mode="dup">
<sup><xsl:number level="any" from="document" format="1"
count="footnote[(_at_)level=current()/@level]"/></sup>
</xsl:template>
<xsl:template match="footnote[(_at_)level='section']" mode="dup">
<sup><xsl:number level="any" from="section" format="a"
count="footnote[(_at_)level=current()/@level]"/></sup>
</xsl:template>
<xsl:template match="footnote[(_at_)level='table']" mode="dup">
<sup><xsl:number level="any" from="table" format="i"
count="footnote[(_at_)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(_at_)castingthevoid(_dot_)com]
Sent: Tuesday, 28 February 2006 12:34 a.m.
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] 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.
--~------------------------------------------------------------------
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>
--~--