Subject: XPath question
From: cknell@xxxxxxxxxx
Date: Mon, 03 Feb 2003 17:21:54 -0500
|
Every time I think I have a good grasp on XPath, it slips between my fingers. Consider the following XML:
<menu>
<item title="Vegetables">
<item title="tubers">
<item title="potatoes">
<item>Idaho</item>
<item>Maine</item>
<item>Russet</item>
<item>Yam</item>
</item>
</item>
</item>
<item title="Fruits">
<item title="Apples>
<item>Fuji</item>
<item>Granny Smith</item>
<item>Rome</item>
</item>
<item>Milk</item>
</menu>
I have an HTML application for which I must flatten out the hierachy of this XML document, yet still maintain a link to the parent element for each child element. To this end I have decided to number each element according to its position in the hierarachy and use a "dot-delimitted" format for each element's id (i.01.03.11). I have struggled in vain today to come up with an XPath expression which would tell me how many elements are on the preceding-sibling axis of the parent of a given node. Can anyone straighten me out on this?
Thanks.
--
Charles Knell
cknell@xxxxxxxxxx - email
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
- XPath question
- cknell - Mon, 3 Feb 2003 17:20:38 -0500 (EST) <=
- <Possible follow-ups>
- Andy J. Cupp - Mon, 3 Feb 2003 17:49:51 -0500 (EST)
|
|