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

RE: Grouping data

Subject: RE: Grouping data
From: "Andy J. Cupp" <acupp@xxxxxxxxxxxxxxx>
Date: Thu, 16 Jan 2003 11:08:36 -0600
grouping data
There's a couple things you'll want to look at:

The 'position()' function: When you're processing a list of nodes, this function gives you the number of the current node in the list.  So if you were processing all the <item> nodes using the '<xsl:for-each>' element, position() would tell you which item you were on.

For actually creating nodes, look at the '<xsl:element>' element.

You can find many examples of how to use this stuff in the archives of this list.

Hope I was some help,
Andy

-----Original Message-----
From: Daniel Rodríguez Díaz [mailto:danielr@xxxxxxxxxxxxx]
Sent: Thursday, January 16, 2003 9:10 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:  Grouping data


Hi,
I've got an xml document with 5 nodes and I try to transform it from xml 
into html in the following way:
I want to put the first 3 nodes inside a <p></p> using certain template, 
the rest inside a <div></div> using a different template.

I know how to manage the elements and count them but I don't know how to 
create a node including templates when I'm in the first or third node.

Here is an example to explain better:


XML

<raiz>
<item>
<nombre>Uno</nombre>
<apellidos>1111</apellidos>
</item>
<item>
<nombre>Dos</nombre>
<apellidos>2222</apellidos>
</item>
<item>
<nombre>Tres</nombre>
<apellidos>3333</apellidos>
</item>
<item>
<nombre>Cuatro</nombre>
<apellidos>4444</apellidos>
</item>
<item>
<nombre>Cinco</nombre>
<apellidos>5555</apellidos>
</item>
</raiz>


HTML

<p>
<h1>Uno</h1><h2>1111</h2>
<h1>Dos</h1><h2>2222</h2>
<h1>Tres</h1><h2>3333</h2>
</p>
<div>
<h3>Cinco</h3>
<h3>Cinco</h3>
</div>

Thanks in advance


 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

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.