[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[xsl] Sub group grouping using generate-id
Subject: [xsl] Sub group grouping using generate-id From: "Wiepert, Mathieu" <Wiepert.Mathieu@xxxxxxxx> Date: Fri, 15 Aug 2003 16:01:48 -0500 |
I have tried to simplify the problem, but still have difficulty getting my expected results. Given this simplified xml doc, <experiment> <genotypesInSubject> <id>1</id> <pcrResuts> <variant> <position>1</position> </variant> <variant> <position>2</position> </variant> </pcrResuts> </genotypesInSubject> <genotypesInSubject> <id>2</id> <pcrResuts> <variant> <position>1</position> </variant> <variant> <position>2</position> </variant> <variant> <position>3</position> </variant> </pcrResuts> </genotypesInSubject> </experiment> <experiment> <genotypesInSubject> <id>1</id> <pcrResuts> <variant> <position>1</position> </variant> <variant> <position>2</position> </variant> <variant> <position>4</position> </variant> </pcrResuts> </genotypesInSubject> <genotypesInSubject> <id>2</id> <pcrResuts> <variant> <position>1</position> </variant> <variant> <position>2</position> </variant> <variant> <position>3</position> </variant> </pcrResuts> </genotypesInSubject> </experiment> During processing, if I am at a given <experiment> node, how do I get a variable holding unique variant nodes, as classified by the <position> element? Or put another way, how do I get a list of <variant>'s unique to an <experiment> node, using the <position> child element of <variant> as the key? Expected results would be experiment node 1 has variant at position1,2, and 3 experiment node 2 has variant at position 1,2,3, and 4 I have been trying to get this filled in but have been spectacularly unsuccessful. Here is one of the very many attempts... <xsl:template match="/"> <xsl:variable name="expNodes" select="//n1:experiment"/> <xsl:key name="variant-key" match="//n1:variant" use="n1:position"/> . . <xsl:for-each select="$expNodes"> <xsl:variable name="unique-exp-variants" select="//n1:variant[generate-id(//n1:position)=generate-id(key('variant-key',.)[1])]"/> . . Any hints would be appreciated, thanks -mat XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] new xml-based flash SWF suppo, Kucera, Rich | Thread | RE: [xsl] Sub group grouping using , Américo Albuquerque |
Re: [xsl] jd.xsltc translet perform, Johannes Döbler | Date | [xsl] Replacing words in an element, Joseph Tan |
Month |
Keywords