RE: How can I test the last preceding text character?
How about this? <xsl:if test="matches(preceding::text(), 'x$')">etc.</xsl:if> ~ Scott -----Original Message----- From: Sascha Mantscheff [mailto:922492@xxxxxx] Sent: Monday, October 29, 2007 4:28 PM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: 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::*/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?
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format