Re: [xsl] XPath: excluding a descendant

Subject: Re: [xsl] XPath: excluding a descendant
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 2 Sep 2003 14:37:16 +0100

<xsl:template match="LongitudeDecimal">

that will have to be

<xsl:template match="abcd:LongitudeDecimal">

otherwise it's not going to match since you said they are all in teh
namespace.

> There are no children to LongitudeDecimal, so I would not have to process them.
It has a text node child that contains 29.16 in your example.
Having this template stops that being processed.


> how do I apply the LongitudeDecimal-template to Gathering,
You don't. You don't want to do anything special to Gathering at all,
you only have one such node, and you want to process it.
The only thing that you want to do is process LongitudeDecimal
in a way that does not produce any output, which is done by having an
empty template.

> the output I get from just calling the Gathering node? 
You are not understanding the way xslt processes the input.
applying templates to the gathering node does _not_ give you all the
descendents. It just gives you what is in the template for Gathering
which by default is


<xsl:template match="abcd:Gathering">
   <xsl:apply-templates/>
</xsl:template>

which produces _nothing_ and then recurses to process the children of
Gathering. And so on... so it is only when you get to processing the
LongitudeDecimal node that you want to do anything different.

Of course, you haven't actually shown us your template for Gathering.
if by chance you have done

<xsl:template match="abcd:Gathering">
   <xsl:value-of select="."/>
</xsl:template>

Then you arenot applying templates to teh children of gathering, so
obviously changing the templates will have no effect. But if you are
doing that, the solution is simple! don't do that, apply templates
instead.

David




David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

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


Current Thread