Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Select multiple nodes in XSL

From: David Carlisle <davidc@---.--.-->
To: NULL
Date: 12/2/2004 10:51:00 PM
> <xsl:template match="header1 | header2">
>   <!-- rest of the template -->
> </xsl:template>
> 
> And I call it by:
> 
> <xsl:apply-templates select="header1 | header2"/>
> 
> The issue I'm having is that my XSL is being executed twice, once for
> each node (header1 and header2) rather than going thru both nodes at
> once.  The goal is to go thru both nodes at once.  Any assistance
> would be appreciated.
> 
> 

you select all header1 and header2 nodes and apply templates to them,
each of those templates is going to execute
  -- rest of the template --
actualy they may be executed in any (time) order but the results will be
merged in to the result tree based on position of the nodes in the
source.

So since you have a header1 and a header2 in your example source you get
the results of transforming those nodes.

I can't guess from your description what result you _did_ want so can't
suggest any change to the xsl. It may be that the templates for header1
and header2 are exeecuted "at once" in a concurrent xslt implementation,
but clearly (or not?) the results of each template exeution have to be
attatched to the result tree at different points.

It would help if you said what output you need from your sample input.

If you only want to process at most one header you could do

<xsl:apply-templates select="(header1 | header2)[1]"/>

but that processes one and ignores the other, which doesn't seem to
match the description of your desired outcome.

David


transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent