[xsl] How do can I select distinct nodes and adding a counter at the sa me time

Subject: [xsl] How do can I select distinct nodes and adding a counter at the sa me time
From: Cams Ismael <Ismael.Cams@xxxxxxxxxxxxxxx>
Date: Thu, 21 Nov 2002 17:20:53 +0100
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