|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] XSL: Returning a selected node in the context of it's ancest
Has anyone tried to use XSL to return a document fragment that includes the necessary parent nodes for a selected node, so that the lineage of the selected node is maintained? I've got this working using the ancestor() function recursively, but of course this returns the nodes inside out - i.e. parent, then grandparent, then greatgrandparent etc. What I really want to do is go back to the root, and then copy the intermediate nodes down to the node that was selected. For example, given the document <vendor name="james"> <product id="1234"> <material>SiO2</material> </product> <product id="5678"> <material>CO2</material> </product> </vendor> and a stylesheet fragment <xsl:for-each select="/vendor/product/material[.='SiO2']"> to return the fragment <vendor name="james"> <product id="1234"> <material>SiO2</material> </product> </vendor> p.s Using IE5, but if anyone has any sample code for another parser I'd love to see it. Best regards, James Carlyle www.xmltree.com - directory of XML content on the web 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








