Subject: RE: [xsl] generate full xpath name to an attribute? From: Ray Tayek <rtayek@xxxxxxxxx> Date: Mon, 31 Mar 2003 09:12:32 -0800 |
> yikes! - looks like the simplest way is to have: > > <xsl:template match="name"> > <xsl:for-each select="ancestor-of-self::*"> > <xsl:value-of select="name()" /><xsl:text>/</xsl:text> > </xsl:for-each> > <xsl:value-of select="." /> > </xsl:template> >
That won't work if you want to generate a path that's independent of the namespace context.
If you want the path expression to be context-independent then you need to generate steps of the form
*[local-name()='x' and namespace-uri()='y']
Also, the code above generates a path such as a/b/c/d which will select many elements, whereas you probably want one that selects a single element such as a[3]/b[2]/c[89]/d[1].
But in this case the "tumbler" path of the form *[23]/*[2]/*[17] is simpler, and avoids namespace problems entirely.
As you see, there are multiple solutions to this requirement - which is because there are actually a number of different requirements. This is why there is no standard function.....
--- ray tayek http://tayek.com/ actively seeking mentoring or telecommuting work vice chair orange county java users group http://www.ocjug.org/ hate spam? http://samspade.org/ssw/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] generate full xpath name , Michael Kay | Thread | [xsl] Re: generate full xpath name , Dimitre Novatchev |
Re: [xsl] empty element as an end-m, Wendell Piez | Date | RE: [xsl] How to change element nod, Americo Albuquerque |
Month |