This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Matching or testing dynamically created attributes
- To: xsl-list at lists dot mulberrytech dot com
- Subject: Re: [xsl] Matching or testing dynamically created attributes
- From: David Carlisle <davidc at nag dot co dot uk>
- Date: Thu, 21 Jun 2001 18:22:13 +0100
- References: <009401c0fa73$d0819470$afdc0a0a@therapyexpert.com>
- Reply-To: xsl-list at lists dot mulberrytech dot com
Short version: While in a for-each loop, how can I match the current node's
attribute (say @NAME) against an attribute in another node somewhere else
without knowing that attribute's name?
Essentially, "if the @NAME attribute
of this node is the same as an attribute in the node over there, do
something..."
<xsl:for-each select="xxx">
<xsl:if test="@NAME=../../x/y//z/@*"/>
will test the value of the current NAME attribute against the node set
of all attributes selected and be true if any of them matches.
If you want to know which ones match, do instead
<xsl:for-each select="xxx">
<xsl:for-each (or copy-of or variable or apply-templates)
select="../../x/y//z/@*[.=current()/@NAME]">
or, this NAME is "row1". if there is an attribute in the node
over there named "row1" what is its value?
<xsl:for-each select="xxx">
<xsl:value-of
select="../../x/y//z/@*[name(.)=current()/@NAME]"/>
David
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit http://www.star.net.uk/stats.asp or alternatively call
Star Internet for details on the Virus Scanning Service.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list