On 6/17/05, David Carlisle <davidc(_at_)nag(_dot_)co(_dot_)uk> wrote:
Specifically, where there's more than "cite" element in a
"p", I get
duplicate cite elements for each one in the output.
well this processes all sibling cites each time.
<xsl:apply-templates select="../cite" mode="clean"/>
I'd guess the intention is to just to process the following node
(which is a cite) so
<xsl:apply-templates select="following-sibling::cite[1]"
mode="clean"/>
Thanks David. That does solve the duplicate problem, but
also leaves off the second cite element:
<div>Some text and more text .[XXX] Some <EM>more</EM> text.
Some text and more text .</div>
Really?
I get (with Saxon 8.4b):
<div>Some text and more text .[XXX] Some <EM>more</EM> text. Some text
and more text .[XXX]</div>
From this source:
<p>Some text and more text <cite/>. Some <em>more</em> text. Some text
and more text <cite/>.</p>
And this XSLT:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:bib="http://www.example.org" version="2.0"
exclude-result-prefixes="bib">
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<div>
<xsl:apply-templates/>
</div>
</xsl:template>
<xsl:template match="cite" mode="clean">[XXX]</xsl:template>
<xsl:template match="em">
<EM>
<xsl:apply-templates/>
</EM>
</xsl:template>
<xsl:template
match="text()[preceding-sibling::node()[1][self::cite]]">
<xsl:choose>
<xsl:when test="substring(.,1,1) = '.'">
<xsl:text>.</xsl:text>
<xsl:apply-templates select="preceding-sibling::cite[1]"
mode="clean"/>
<xsl:copy-of select="substring(.,2)"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
Cheers
andrew
--~------------------------------------------------------------------
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>
--~--