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

group using element in two different places in xml

Subject: group using element in two different places in xml
From: "James Steven" <JSteven@xxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 5 Jul 2004 16:19:17 +0100
christmas in different places
Hello
Currently I have a table which uses the xml and pseudo code shown below:

<a>
 <b>
  <c>
   <d>
   <data>
	<info>group1</info>
      <info2>two</info2>
      <info3>three</info4>
   </data>
   <data>
	<info>group3</info>
      <info2>four</info2>
      <info3>five</info4>
   </data>
   <data>
	<info>group1</info>
      <info2>two</info2>
      <info3>five</info4>
   </data>
   <data2>
	<info>group1</info>
      <info2>two</info2>
      <info3>four</info4>
   </data2>
   <data2>
      <info>group2</info>
      <info2>two</info2>
      <info3>five</info4>
   </data2>
   <data2>
	<info>group3</info>
      <info2>three</info2>
      <info3>four</info4>
   </data2>
    </d>
   </c>
 </b>
</a>

<xsl:key name="entries" match="data" use="info"/>
<xsl:key name="entries2" match="data2" use="info"/>
 <xsl:template match="a"/>
  <xsl:for-each
select="d/data[generate-id(.)=generate-id(key('entries',info))] |
d/data2[generate-id(.)=generate-id(key('entries2',info))] ">
   <xsl:for-each select="key('entries',info)">
   <!--display value of each unique <info> as header and other elements in
<data>--!>
   </xsl:for-each>
   <xsl:for-each select="key('entries2',info)">
   <!--display other each unique <info> as header and other elements in
<data2>--!>
   </xsl:for-each>
</xsl:for-each>
</xsl:template>

The pseudo code above produces a table displaying each <data> and <data2> in
whatever <info> group it has the same value as.  The problem with this
method is that it produces each <info> group twice as <xsl:for-each> adds
both d/data and d/data2.  How do I list each unique <info> and the <data> or
<data2> that corresponds with it without duplicating?

Thanks for any help.
James









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.