This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: Apostrification -- Re: Generating XPath expressions


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@RamseySystems.co.uk


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


> From: Francis Norton [mailto:francis@redrice.com]
> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]