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

Selecting last text() from fragment of unknown depth?

Subject: Selecting last text() from fragment of unknown depth?
From: "Adam Desaulniers" <avalonsunsplashtech@xxxxxxxxxxx>
Date: Sat, 05 Feb 2005 08:19:32 -0800
adam desaulniers
With this template

<xsl:template match="submission.excerpt//node()/@*|submission.excerpt//node()">
<xsl:copy><xsl:apply-templates select="./@*|./node()" /></xsl:copy>
</xsl:template>


have I made it impossible to also transform (inline) the last occurring textnode beneath submission.excerpt/node()?

So far all my recursion attempts (looking for node()[last()][self::text()] at each level) have yielded 3 variations: *only* the last text(), everything *except* the last text(), or the whole thing and then the last text() appended again.

<xsl:choose>
<xsl:when test="./node()[last()][self::text()]">
	<xsl:copy>
		<xsl:apply-templates select="./@*|./node()[position() != last()]" />
		<xsl:value-of select="./node()[last()]" />...
	</xsl:copy>
</xsl:when>
<xsl:otherwise>
	<!-- look again next level, etc -->
</xsl:otherwise>
</xsl:choose>

It's meant to take an XHTML string (truncated from db then made well-formed again by PHP5's loadHTML method) and replace the end of the last text() -- after the last occuring space character -- with an ellipsis, which I've now heard 3x is 'impossible' in XSLT 1.0 but it's not official till I've heard it here.

Undying gratitude,
-Adam.

_________________________________________________________________
Take advantage of powerful junk e-mail filters built on patented Microsoft. SmartScreen Technology. http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines Start enjoying all the benefits of MSN. Premium right now and get the first two months FREE*.


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.