[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

Subject: XSL: Returning a selected node in the context of it's ancestors
From: "äë" <james@xxxxxxxxxxx>
Date: Tue, 19 Oct 1999 19:02:34 +0100
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


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.