Subject: Re: how to select part of the tree? From: Dan Morrison <dman@xxxxxxxx> Date: Wed, 29 Mar 2000 15:24:23 +1200 |
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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: how to select part of the tree?, K. Ari Krupnikov | Thread | Re: how to select part of the tree?, Warren Hedley |
Re: how to select part of the tree?, John E. Simpson | Date | Re: Problem with <xsl:eval>, Scott Boag/CAM/Lotus |
Month |