|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Sub group grouping using generate-id
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








