RE: [xsl] comparing attributes values dynamically

Subject: RE: [xsl] comparing attributes values dynamically
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Mon, 5 Jan 2004 18:31:26 -0000
> 
> My XSLT code has a template into which I pass the two
> nodes in $newNode and $oldNode but I'm getting compilation 
> errors. I know the following code is wrong but hopefully 
> it'll be obvious what I'm trying to accomplish with it:
> 
> <xsl:for-each select="$newNode/@*">
>   <xsl:if test="string(current()) = $oldNode/@{name()}">

XPath expressions *never* contain curly braces. They are only used to
surround an XPath expression that is embedded in an ordinary attribute
value.

You want

test=". = $oldNode/@*[name()=name(current())]"

Michael Kay



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


Current Thread