This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Correlation between two xml trees



<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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]