Re: Matching or testing dynamically created attributes
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
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format