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

Help on node selection

Subject: Help on node selection
From: "Fabien Tillier" <f.tillier@xxxxxxxx>
Date: Fri, 27 Aug 2010 13:42:53 +0200
 Help on node selection
Hi List.

I want to be able to rebuild an XML document with an XSL template. The idea is
o duplicate some parts of the source XML and insert a few more elements.
My question is pretty basic, so far.

Suppose I get an XML document

<data>
      <row>
                      <N1>1</N1>
      <N2>120</N2>
      </row>
      <row>
                      <N1>1</N1>
      <N2>120</N2>
      </row>
      <row>
                      <N1>2</N1>
      <N2>120</N2>
      </row>
      <row>
                      <N1>2</N1>
      <N2>120</N2>
      </row>
      <row>
                      <N1>1</N1>
      <N2>110</N2>
      </row>
</data>

I want to first process nodes which have N1 = 1, then nodes with N1=2. But I
want to call the template only once with all matching nodes (so once with N1=1
nodes, and once with N1=2 nodes), because I am building a group from these
Thus, I have tried with

<xsl:apply-templates select="//row[N1=1]" mode="headers"/>

But my template

<xsl:template match="row" mode="headers">
                Headers             
</xsl:template>

Is called on each matching node...(thus 3 times here), rather than once, and
then gets some loop to individually treat each node from the list.
How can I proceed ?

Thanks in advance
Best regards,
Fabien

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-2011 All Rights Reserved.