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

How do can I select distinct nodes and adding a counte

Subject: How do can I select distinct nodes and adding a counter at the same time
From: Cams Ismael <Ismael.Cams@xxxxxxxxxxxxxxx>
Date: Thu, 21 Nov 2002 17:20:53 +0100
xpath select distinct nodes
Hello,

what I trying to do is the following:
I have two xml files. 

The first one looks like this

	<mappings>
		<map oid="1.5.6.3" id="1"/>
		<map oid="1.5.8.1.2" id="3"/>
	</mappings>

The second one looks like this:

	<xx>
		<xxx>.1.5.6.3.8
		   <xxxx att1=".1.5.6.3.8"/>
		<xxx>
		<xxx>.1.5.6.3.10
		   <xxxx att2="1.5.6.3.9"/>
		<xxx>
		<xxx>.1.5.6.4.5</xxx>
	</xx>

On the second file I execute my stylesheet. First I determine the last id
number that is defined in the first file (by means of the document
function). Second I copy the map tags that are already defined in the first
file. What I want to do know is getting out of the second xml file the
values of the attributes mapped onto an odd number (5,7,9) when this
attribute is available. When not available the text value of the tag must be
used. So in this example the result file should be:

	<mappings>
		<map oid="1.5.6.3" id="1"/>
		<map oid="1.5.8.1.2" id="3"/>
		<map oid=".1.5.6.3.8" id="5"/>
		<map oid="1.5.6.3.9" id="7"/>
		<map oid=".1.5.6.4.5" id="9"/>
	</mappings>

What I do know is first grouping on the attributes, so I get every value
only once. Therefore I have used the sorting function. The problem is I
don't find a method to generate the id. I can't use the count function
because some nodes of the nodeset are not used (only unique values are
needed). Somebody an idea ?

Kind regards,
Ismaël




 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.