RE: [xsl] Apostrification -- Re: Generating XPath expressions

Subject: RE: [xsl] Apostrification -- Re: Generating XPath expressions
From: "Charlie McCay" <Charlie@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 5 Apr 2001 14:21:39 +0100
Richard

The following from Francis Norton may be what you are looking for -- I
couldn't find it in the archive -- hence the re-copy to the list

All the best

Charlie

Charlie McCay, charlie@xxxxxxxxxxxxxxxxxxx


> I'm trying to produce which is som debugging
> message that generates and X-Path to the problem
>


> From: Francis Norton [mailto:francis@xxxxxxxxxxx]
> Sent: 12 December 2000 14:17
> Subject: Re: Generating XPath expressions
>
>
> Try this ...
>
> <xsl:template name="mypath">
>   <xsl:for-each select="(ancestor-or-self::*|@*)">
>     <xsl:choose>
>       <xsl:when test=". = /"/>
>       <xsl:otherwise>/<xsl:value-of select=
> 	"concat(name(.), '[',
> count(preceding-sibling::*[name(current()) =
> name(.)]) + 1, ']')"
> 					/>
>       </xsl:otherwise>
>     </xsl:choose>
>   </xsl:for-each>
> </xsl:template>
>
> ... for an elements-only solution in XSLT, that generates
> "/a[1]/b[3]/c[1]" style xpath for any given context node.
>
> Francis.


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


Current Thread