Subject: group using element in two different places in xml From: "James Steven" <JSteven@xxxxxxxxxxxxxxxxxxxxx> Date: Mon, 5 Jul 2004 16:19:17 +0100 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Forwarding..., Pierre | Thread | Re: [xsl] group using element in tw, David Carlisle |
RE: [xsl] Forwarding..., Pieter Reint Siegers | Date | Re: [xsl] group using element in tw, David Carlisle |
Month |