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

<xsl:key> problem

Subject: <xsl:key> problem
From: "Jan Weiss" <jweiss@xxxxxxxxxxxxxxxxxx>
Date: Mon, 13 Aug 2001 14:54:17 +0200
xsl key for each row
hi all,

perhaps i put <xsl:key> at the wrong place??
what else could be the reason that this would not work??

i want to group my xml by bct_art_nr and get an output where all bct_index
are together if they have unique bct_art_nr:

i want to get:
<row>
	<articlenr>123</articlenr>
	<index> 2 </index>
	<index> 1 </index>
	<index> 0 </index>
</row>
<row>
	<articlenr>456</articlenr>
	<index> 3 </index>
	<index> 2 </index>
	<index> 1 </index>
</row>





my xml structure to transform:

<results>
	<row>
		<@db.bct_dm_t01.bct_art_nr>123</@db.bct_dm_t01.bct_art_nr>
		<@db.bct_mod_t02.bct_index>2  </@db.bct_mod_t02.bct_index>
	</row>
	<row>
		<@db.bct_dm_t01.bct_art_nr>123</@db.bct_dm_t01.bct_art_nr>
		<@db.bct_mod_t02.bct_index>3  </@db.bct_mod_t02.bct_index>
	</row>
	<row>
		<@db.bct_dm_t01.bct_art_nr>456</@db.bct_dm_t01.bct_art_nr>
		<@db.bct_mod_t02.bct_index>1  </@db.bct_mod_t02.bct_index>
	</row>
</results>

my xsl file:
<!-- top-level -->
<xsl:key name="row-by-artnr" match="row" use="@db.bct_dm_t01.bct_art_nr"  />

<xsl:template match="results">


<Abfrageergebnisse>
<xsl:for-each
select="row[count(.|key('row-by-artnr',@db.bct_dm_t01.bct_art_nr)[1]) = 1]">


   		<col>
			<xsl:variable name="nummer" select="@db.bct_dm_t01.bct_art_nr"/>

      		<artnr nummer="{$nummer}">
	<index><xsl:copy-of select="key('row-by-artnr',@db.bct_dm_t01.bct_art_nr)/
@db.bct_mod_t02.bct_index" />
	</index>
   			</artnr>
    		</col>



		</xsl:for-each>

	</Abfrageergebnisse>
</xsl:template>









very hopefully

jan








Jan Weiss
IT - Student
BCT Technology AG
Im Lossenfeld 9
D-77731 Willstaett

Tel: +49-7852-996-237
Fax:+49-7852-996-100

mailto:jweiss@xxxxxxxxxxxxxxxxxx
http://www.bct-technology.com
http://www.bct-portal.com



 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.