Re: [xsl] Correlation between two xml trees

Subject: Re: [xsl] Correlation between two xml trees
From: Antonio Fiol <fiol@xxxxxxxxxx>
Date: Thu, 06 Jun 2002 14:00:43 +0200


<xsl:template match="z:row">
<data>
<xsl:variable name="data" select="."/>
<xsl:for-each select="$outputdef/root/column">
<xsl:element name="{@tagname}">
<xsl:value-of select="$data/@*[name()=current()/@dbcolumn]"/>
</xsl:element>
</xsl:for-each>
</data>
</xsl:template>



I understand the use of the xsl:variable,


Probably you have not fully understood (catching that was difficult to me) that what you are assigning to the variable "data" is the node-set specified by ".".

but the rest of the expression
is still baffling to me:

select="$data/@*[name()=current()/@dbcolumn]"


Then you are selecting:

all (*) the attributes (@) of the node contained in $data whose name() equals the dbcolumn attribute (@) of current() node.

current() node is the way you have to refer to the node that was current "outside the [ ]", as referring to "." inside the [ ] you mean the node you are testing for inclusion on the result.

HTH.


Antonio Fiol




XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list


Current Thread