Tracy,
assuming
<table>
<columns>
<column name="code" value="Code" />
<column name="description" value="Desc" />
<column name="price" value="Price" />
<column name="weight" value="Weight" />
<column name="value" value="Value" />
</columns>
</table>
is loaded into a variable named Doc2, then I think the following should
work:
<xsl:template match="data">
<data>
<xsl:apply-templates/>
</data>
</xsl:template>
<xsl:template match="row">
<xsl:variable name="NumPriorAttributes"
select="count(preceding-sibling::*/@*[not(name()='trade')])"/>
<xsl:for-each select="@*[not(name()='trade')]">
<xsl:variable name="AttName" select="name()"/>
<xsl:variable name="AttValue" select="."/>
<row id="{$NumPriorAttributes + position()}"
key="{xx:node-set($Doc2)/table/columns/column[(_at_)name=$AttName]/@value}"
value="{$AttValue}"/>
</xsl:for-each>
</xsl:template>
where xx:node-set is the node-set extension function for your particular
XSLT processor.
Cheers,
...sam
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list