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

Re: Unique IDs?

Subject: Re: Unique IDs?
From: Sven Waibel <sven.waibel@xxxxxxxx>
Date: Wed, 23 Mar 2005 11:32:12 +0100
unique pc id
Why the pc element?

You have an unique ID by concat tc id and pc/status id

tc1: status id 	= 1231
		  1232
		  1231

tc2: status id 	= 1245
		  1241

tc3: status id 	= 1251

So i should yield:
tc1:	1231
	1232

tc2:	1245
	1241

tc3:	1251


????
Sven

Michael Kay wrote:

> And my answer is unchanged.
> 
> Michael Kay
> http://www.saxonica.com/ 
> 
> 
>>-----Original Message-----
>>From: Sven Waibel [mailto:sven.waibel@xxxxxxxx] 
>>Sent: 23 March 2005 10:22
>>To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
>>Subject: Re:  Unique IDs?
>>
>>That's the correct xml:
>>
>><tc id="123">
>>	<pc>
>>		<status id="1" name="Status 1"/>
>>		<status id="2" name="Status 2"/>
>>		<status id="1" name="Status 1"/>
>>	</pc>
>></tc>
>><tc id="124">
>>	<pc>
>>		<status id="5" name="Status 5"/>
>>		<status id="1" name="Status 1"/>
>>	</pc>
>></tc>
>><tc id="125">
>>	<pc>
>>		<status id="1" name="Status 1"/>
>>	</pc>
>></tc>
>>
>>Michael Kay wrote:
>>
>>
>>>Your stylesheet is giving you exactly what you asked for: 
>>
>>it's outputting
>>
>>>the Status value only if it is the first one with that 
>>
>>combination of id's.
>>
>>>To treat the contents of each <pc> as a separate group you 
>>
>>will need to
>>
>>>factor the identity (generate-id()) of the pc element into 
>>
>>the key value.
>>
>>>Michael Kay
>>>http://www.saxonica.com/ 
>>>
>>>
>>>
>>>>-----Original Message-----
>>>>From: Sven Waibel [mailto:sven.waibel@xxxxxxxx] 
>>>>Sent: 23 March 2005 08:38
>>>>To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
>>>>Subject:  Unique IDs?
>>>>
>>>>
>>>>Good morning!
>>>>
>>>>in my xsl:
>>>>
>>>><xsl:key name="ids" match="tc/pc/*[@id]" 
>>>>use="concat(../../@id,@id)" />
>>>>
>>>><xsl:template match="pc">
>>>>	<xsl:apply-templates select="*[@id and generate-id(.)= 
>>>>generate-id(key('ids', concat(../../@id,@id)))]" />
>>>></xsl:template>
>>>>
>>>><xsl:template match="tc/pc/*[@id]">
>>>> <fo:block><xsl:value-of select="@name" /></fo:block>
>>>></xsl:template>
>>>>
>>>>
>>>>my xml:
>>>>
>>>><tc id="123">
>>>>	<pc>
>>>>		<status id="1" name="Status 1"/>
>>>>		<status id="2" name="Status 2"/>
>>>>		<status id="1" name="Status 1"/>
>>>>	</pc>
>>>>	<pc>
>>>>		<status id="5" name="Status 5"/>
>>>>		<status id="1" name="Status 1"/>
>>>>	</pc>
>>>>	<pc>
>>>>		<status id="1" name="Status 1"/>
>>>>	</pc>
>>>></tc>
>>>>
>>>>The current output looks as followed:
>>>>
>>>>"pc1"   Status 1
>>>>	Status 2
>>>>
>>>>"pc2"	Status 5
>>>>
>>>>"pc3" 	
>>>>
>>>>
>>>>The output should look as followed:
>>>>
>>>>"pc1"   Status 1
>>>>	Status 2
>>>>
>>>>"pc2"	Status 5
>>>>	Status 1
>>>>
>>>>"pc3" 	Status 1
>>>>
>>>>Status No. must not exist more than one in one "pc".
>>>>
>>>>What's wrong with my Stylesheet?
>>>>
>>>>Thanks
>>>>
>>>>Best regards
>>>>Sven

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.