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

How can I test the last preceding text character?

Subject: How can I test the last preceding text character?
From: Sascha Mantscheff <922492@xxxxxx>
Date: Mon, 29 Oct 2007 22:27:37 +0100
 How can I test the last preceding text character?
How do I test if the very last character of any preceding text - be it
in a parent or a sibling - has a certain value?
Example:

<a>
    This is parent text a not ending with an x.
    <d>This ends with an x</d>
    <e>This should issue a message.</e>
    This is parent text ending with an x
</a>

Now I want to know for each child element is if it is preceded by an
"x".
I can check the sibling with

<xsl:if test="matches(preceding-sibling::*[1]/text()[last()],'x\$') ">
    <xsl:message>
        Element <xsl:value-of select="name()"/> is preceded by an x.
    </xsl:message>
</xsl:if>

But I cannot test the surrounding parent content with the same model
because the parent text may surround the child text.

What's the way to do it?

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.