|
Subject: [xsl] Re: attribute values as name value pair From: "Sam Byland" <shbyland@xxxxxxxxxxx> Date: Thu, 26 Feb 2004 22:55:36 -0500 |
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[@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
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] attribute values as name , James A. Robinson | Thread | Re: [xsl] Re: attribute values as n, James A. Robinson |
| RE: [xsl] Outputting A tag informat, Josh Canfield | Date | RE: [xsl] Outputting A tag informat, Vivek Shinde |
| Month |