|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Autogenerating XPath from XML?
Hi Kenji,
> I'm looking for a way to programatically create a list of XPaths
> based on a given XML document. I can easily create an XPath that
> will sort of work with a standard XML document that doesn't have
> multiple items of the same name.
The easiest thing to do is to use xsl:number to number the elements
amongst their siblings. Try iterating over the elements as follows to
create the path to the current element:
<xsl:for-each select="ancestor-or-self::*">
<xsl:text />/<xsl:value-of select="name()" />
<xsl:text />[<xsl:number />]<xsl:text />
</xsl:for-each>
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








