[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: how to select part of the tree?
K. Ari Krupnikov wrote: > > Hi, > I'm trying to select some of the nodes in an XML document, but I keep > getting the whole tree. How do I make sure only <make> and <model> nodes > in this example are returned? > looks like you have to suppress the info you don't want A quick way is <xsl:template match="*"></xsl:template> and have your actual data-requests go <xsl:template match="make"> <b><xsl:value-of /></b> </xsl:template> but that'll get some annoying side-effects pretty quick. Better solution is to be more explicit about what you DO want, and define <xsl:template match="vehicle"> <xsl:apply-templates select="make"/> <xsl:apply-templates select="model"/> </xsl:template> As this wil be modular (easier to extend), and should cause the vehicle template to not process the other info by default. There's a dozen more ways to get the same effect tho' cheers, .dan. -- :=====================:====================: : Dan Morrison : The Web Limited : : http://here.is/dan : http://web.co.nz : : dman@xxxxxxxx : danm@xxxxxxxxx : : 04 384 1472 : 04 495 8250 : : 021 115 7339 : : :.....................:....................: : If ignorance is bliss, why aren't more people happy? :.........................................: 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
|