[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: preceding/following character?

Subject: Re: preceding/following character?
From: Bruce D'Arcus <bdarcus@xxxxxxxxx>
Date: Mon, 20 Jun 2005 08:55:47 -0400
Re:  preceding/following character?
On Jun 20, 2005, at 5:24 AM, David Carlisle wrote:

<xsl:template match="cite[not(following-sibling::node()[1][self::text()[starts- with(.,'.')]])]">
<xsl:apply-templates mode="clean" select="."/>
</xsl:template>


<xsl:template match="text()[preceding-sibling::node()[1][self::cite]][starts- with(.,'.')]">
<xsl:text>.</xsl:text>
<xsl:apply-templates select="preceding-sibling::cite[1]" mode="clean"/>
<xsl:copy-of select="substring(.,2)"/>
</xsl:template>

Cool; thanks! If I understand right, this has the advantage that it the separate templates makes it easier to use in the context of importing stylesheets.


$ saxon cite.xml cite.xsl
<?xml version="1.0" encoding="utf-8"?><div>
Some text and more text .[XXX1] Some <EM>more</EM> text. Some text
and more text .[XXX2]ffff[XXX3]

Some text and more text [XXX1]<EM>. Some more</EM> text. Some text
and more text .[XXX2]ffff[XXX3]
</div>

If I could just ask one more question: how conceptually would I then remove the preceding (now superfluous) space? Maybe use translate() to convert " ." to "."?


Bruce

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.