RE: [xsl] Selecting only one element using templates

Subject: RE: [xsl] Selecting only one element using templates
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Mon, 1 Dec 2003 12:37:10 -0000
Sorry, don't understand the question. You say you "just want to select
the <name> node". But there are five nodes called <name> in your
example. What output are you trying to produce?

Michael Kay

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of JCS
> Sent: 01 December 2003 09:00
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] Selecting only one element using templates
> 
> 
> Hello,
> 
> I'm new to XSL/T and I've been reading the list archives, the 
> tutorials available in and around the net, etc., but I can't 
> seem to find an answer to a simple question (which is usually 
> the case with simple "abstract"
> questions) so I hope nobody minds if I ask here.
> 
> I've got an XML structure as so:
> 
> <name></name>
> <name></name>
> <name>
>  <name></name>
>   <list>
>   <item></item>
>   <list>
> </name>
> <name></name>
> 
> Now, I've been able to get at what I want using the examples 
> provided by this list, so I'm not having difficulty with the 
> more intermediate steps, however, I'm having difficulty 
> getting my head this:
> 
> What if I just want to select the <name> node? If I use 
> <xsl:apply-templates/> and select "name" I get all name 
> elements, plus the item element which I don't want. I just 
> want a list of names from the name elements.
> 
> Do I have to specify a template for each element in an XML 
> document? That seems rather tedious, especially if I have a 
> lot of elements within <name> elements used as containers.
> 
> Any help is appreciated,
> 
> TiA,
> 
> /johnny :)
> 
> -- 
> "I'm not normally a praying man, but if you're up there 
> please save me Superman!" 
> 
> Homer Simpson
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread