[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] General rule for designing XPath expressions to return
Hi Folks, This XPath expression says: select all <section> element's <head> element: //section/head But that may not result in returning nodes in document order, as is the case for this input: <section> <section> <head/> <!-- A --> </section> <head/> <!-- B --> </section> "A" occurs first in the document, but is returned second. "B" occurs second in the document, but is returned first. To ensure that the <head> elements are selected in document order we can rewrite the XPath expression to select all <head> elements that have a parent <section> element: /descendant::head[parent::section] Now the first <head> element in the document is the first item returned. The second <head> element in the document is the second item returned. I am seeking a general rule for designing XPath expressions to return the selected items in document order. Can you provide a general rule? /Roger
|
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
|