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

Autogenerating XPath from XML?

Subject: Autogenerating XPath from XML?
From: "Kenji Hollis" <kenji@xxxxxxxxxxxx>
Date: Sun, 29 Sep 2002 11:49:40 -0700
xpath from xml
Hi all you programmers out there

I've looked through the list and not found an answer for this question, so
sorry if someone's already responded to this question.

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.  For instance:

<A>
   <B>
      <C>data</C>
   </B>
   <D>
      <X>y z</X>
   </D>
</A>

Becomes:

//A
//A/B
//A/B/C
//A/B/D
//A/B/D/X

My problem is, when I get to this:

<A>
   <B>
      <VALUE/>
   </B>
   <B>
      <VALUE/>
   </B>
   <B>
      <VALUE/>
   </B>
</A>

I want:

//A
//A/B[1]
//A/B[1]/VALUE
//A/B[2]
//A/B[2]/VALUE
//A/B[3]
//A/B[3]/VALUE

I've tried several ways to do this, and I've tried looking through several
tutorials.  I'm banging my head on this one, as this is programmatically
very difficult.  Mentally, this is a piece-of-cake problem.

Has anyone encountered this type of problem, created a piece of code that
will generate what I'm looking for, or does anyone know of a project that
has done this?

Thanks in advance.
-- Kenji



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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

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.
Email
First Name
Last Name
Company
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.