[xsl] RE: Can I generate position() values for nodes I reference by key()?

Subject: [xsl] RE: Can I generate position() values for nodes I reference by key()?
From: "mwebster" <mwebster@xxxxxxxxxxxxxxx>
Date: Wed, 23 Mar 2005 11:28:55 -0800
I have an XML document with three basic parts.

Part one lists all my available probes and their related information.  Each
probe has a unique ID as an attribute:

       <probe uid="i_QC.20.5prime_factory" name="QC 5prime">

Part two describes where these various probes get positioned on a grid:

       <probeAssignment electrodeIndex="1"
assignedProbe="i_QC.20.5prime_factory"/>

Part three lists data for all the possible locations on the grid:

       <stats index="12543" elementName="e12543">

My task is to change this XML into a spreadsheet with one line for each grid
location with information about the stats and what probe they relate to.


I was doing this by using a for-each to go through the whole probeAssignment
section until it found a probeAssigment/@electrodeIndex that matched the
current stats/@index.  Then I used probeAssignment/@assignedProbe in a
similar manner to find the proper probe/@name and various other bits of
probe information.


As you can imagine, this was very time consuming, so I switched to using the
key() function and got wonderful improvements in speed.  However, the one
thing the for-each business did get me was the position of each particular
<probe> in the list of probes, which is a piece of information I am asked to
display but that does not appear anywhere in the XML. 


So I have these lines:

 
    <xsl:key name="electrodeIndexKey"
match="/pd:chipDesign/pd:layout/pd:microarray/pd:probeAssignment"
use="@electrodeIndex"/>

    <xsl:key name="uidKey" match="/pd:chipDesign/pd:oligoList/pd:probe"
use="@uid"/>

 
And was hoping I could do something like this:

 
    <xsl:key name="positionKey" match="/pd:chipDesign/pd:oligoList/pd:probe"
use="position()"/>


Does anyone have a suggestion on who I could so something like this?


Michael Webster
CombiMatrix Corporation
Software Department
(425) 493-2266

Current Thread