[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: how to select part of the tree?

Subject: Re: how to select part of the tree?
From: Dan Morrison <dman@xxxxxxxx>
Date: Wed, 29 Mar 2000 15:24:23 +1200
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


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.