RE: comment() node test

Subject: RE: comment() node test
From: "Evan Lenz" <elenz@xxxxxxxxxxx>
Date: Fri, 11 Aug 2000 09:05:05 -0700
I want to display the value of a comment *only* when there is one
immediately before the current element (excluding whitespace).  The
stylesheet is actually taking in another stylesheet as its source; the idea
is to provide stylesheet metadata including top-level comments (preceding
each xsl:template), module structure, overridden templates, potential
conflicts, etc.  I owe Mike Kay for a few of the ideas I'm implementing.
Hopefully it will turn out to be something useful.  Does anyone know of any
other efforts in this area? (I'm somewhat familiar with the two approaches
to stylesheet documentation discussed on this list previously.)

Thanks,

Evan Lenz
elenz@xxxxxxxxxxx

-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxx]On Behalf Of Mike Brown
Sent: Thursday, August 10, 2000 6:33 PM
To: xsl-list@xxxxxxxxxxxxxxxx
Subject: Re: comment() node test


Evan Lenz wrote:
> "preceding-sibling::node()[not(self::text())][1][self::comment()]"
>
> This worked just as well.

Here you are getting the set of non-text preceding siblings, taking the
first node in that set, and testing it to see if it's a comment. If the
first non-text preceding sibling is not a comment, this would fail, I
believe.

Isn't "preceding-sibling::comment()[1]" what you want? i.e. from among the
preceding siblings that are comments, the ones (one) for which the context
position is 1?

   - Mike
____________________________________________________________________
Mike J. Brown, software engineer at         My XML/XSL resources:
webb.net in Denver, Colorado, USA           http://www.skew.org/xml/


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


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


Current Thread