This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: XSL to generate XPaths
- To: xsl-list at lists dot mulberrytech dot com
- Subject: Re: [xsl] XSL to generate XPaths
- From: Michael Strasser <M dot Strasser at myrealbox dot com>
- Date: Thu, 17 May 2001 23:20:33 +1000
- Organization: StrassCom Pty Ltd
- References: <3B01BB2E.D0BCDBF0@myrealbox.com>
- Reply-To: xsl-list at lists dot mulberrytech dot com
I found a couple of bugs in my XSL that showed up when an element had an
attribute and child elements with the same names.
> <!-- If this is an attribute node, output '@' before its name. -->
> <xsl:if test="../@*[name() = name(current())]">
The correct test to see if the current node is an attribute is:
count(.|../@*) = count(../@*)
> <!--
> If the parent has more than one node with the same name as
> the current one...
> -->
> <xsl:if test="count(../*[name() = name(current())]) > 1">
Here I needed to check if the current node is an element:
count(.|../*)=count(../*) and count(../*[name()=name(current())]) > 1"
If anyone wants the new version of the whole thing, please let me know.
--
Michael Strasser
Brisbane, Australia
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list