[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Autogenerating XPath from XML?

Subject: RE: Autogenerating XPath from XML?
From: "Kenji Hollis" <kenji@xxxxxxxxxxxx>
Date: Sun, 29 Sep 2002 12:45:40 -0700
create xpath from xml
Hmmmm, this doesn't actually work, because I'm not using a stylesheet to
create the output.  This is being done via a Java program.  I need a way to
do this programatically using Java...

-- Kenji

-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Jeni Tennison
Sent: Sunday, September 29, 2002 12:24 PM
To: Kenji Hollis
Cc: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
Subject: 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 />



Jeni Tennison

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

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

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.