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

RE: === Identifying a unique node in a DOM tree ===

Subject: RE: === Identifying a unique node in a DOM tree ===
From: Jonathan Asbell <jonathan.asbell@xxxxxxxxxxxxxx>
Date: Wed, 31 May 2000 11:34:06 -0400
jonathan asbell
My point of view is if the parser is going to go through the motion of
parsing, how much more trouble is it to grab the full path and make it a
temporary property of the node?

-----Original Message-----
From: Khalid Asad [mailto:asad@xxxxxxxxxxxxx]
Sent: Wednesday, May 31, 2000 10:29 AM
To: xsl-list@xxxxxxxxxxxxxxxx
Subject: Re: === Identifying a unique node in a DOM tree ===


I just can't help asking again ... why, why, why is there not an XPATH
function as part of the XSLT spec? All these loops will kill performance and
it's not even obvious (based on the number of questions on the subject) how
to get the function right.

Khalid

----- Original Message -----
From: "Francis Norton" <francis@xxxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxx>
Sent: Tuesday, May 30, 2000 5:29 PM
Subject: Re: === Identifying a unique node in a DOM tree ===


> Jonathan Asbell wrote:
> >
> ...
>
> > I want to be able to ask the node.."who are you" and it would reply "I
am
> > currently /.people.person.name.John"
> >
>
> David did come up with the solution to this as a one-liner (which I
> luckily saw before I could post my own particularly horrid and laborious
> solution).
>
> Just for completeness, I packaged his solution into two call-by-name
> templates (for attributes and templates) which I've re-posted below only
> because the xsl-list archive seems to be down right now.
>
> Hope this helps -
>
> Francis.
>
>
>
> <!-- paths from elements -->
> <xsl:template name="elementPath">
>   <xsl:for-each select="(ancestor-or-self::*)">/*[<xsl:value-of
>     select="1+count(preceding-sibling::*)"/>]</xsl:for-each>
> </xsl:template>
>
> <!-- paths from attributes -->
> <xsl:template name="attributePath">
>   <xsl:for-each select="parent::*">
>     <xsl:call-template name="elementPath" />
>   </xsl:for-each>
>   <xsl:text>/@</xsl:text>
>   <xsl:value-of select="name(.)"/>
> </xsl:template>
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


 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

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.