Path for a Node 2003-01-07 - By Andrew Welch
Hi,
As stated this is a faq, but just a little guidance might help... You should look into the ancestor-or-self xpath axis, the local-name() and concat() functions.
So, on any particular node you could use:
<xsl:for-each select="ancestor-or-self::*"> <xsl:value-of select="concat('/',local-name())"/> </xsl:for-each>
which would give you '/foo/bar/baz'
from say:
<foo> <bar> <baz> ....
when matching the <baz> element
cheers andrew
> > >Is there a way to get the (X)Path of a node in an XML? > > This is a FAQ about XSLT in general. Have you checked > http://www.dpawson.co.uk > for information? > > >It will be useful in many cases for my project. > > You should clarify (to yourself, at least) what the uses are. > There may be more efficient ways to do what you want. > .................David Marston > > > > --- > Incoming mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.427 / Virus Database: 240 - Release Date: 06/12/2002 > >
--- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.427 / Virus Database: 240 - Release Date: 06/12/2002
|
|