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

Re: comment() node test

Subject: Re: comment() node test
From: "Evan Lenz" <elenz@xxxxxxxxxxx>
Date: Thu, 10 Aug 2000 17:24:13 -0700
previous sibling comment node
Okay, I figured it out after talking it over with someone else.  Whitespace
will get you every time, if you're not careful.

Adding <xsl:strip-space elements="element"/> did the job.  Or I could wrap
it all into the XPath expression as follows, adding an additional predicate
to ensure that whitespace nodes are excluded:

<xsl:value-of
select="preceding-sibling::node()[not(self::text())][1][self::comment()]"/>

This worked just as well.

Evan Lenz
elenz@xxxxxxxxxxx

-----Original Message-----
From: Evan Lenz [mailto:elenz@xxxxxxxxxxx]
Sent: Thursday, August 10, 2000 4:45 PM
To: XSL-List
Subject: comment() node test


I'm trying to display the value of the previous sibling if it is a comment.
What's wrong with my XPath expression?  It won't display anything.

<xsl:for-each select="element">
  <xsl:value-of select="preceding-sibling::node()[1][self::comment()]"/>
</xsl:for-each>


I've confirmed that the parser I'm using passes comments to the XSLT
processor (Instant Saxon), as the comment() node test works in other cases,
such as the following:

<xsl:for-each select="comment()">
  <xsl:value-of select="."/>
</xsl:for-each>

Thanks,

Evan Lenz
elenz@xxxxxxxxxxx


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.