Re: Screening values from two attribute-sets
I'm not sure why this is a faq but it is (come up several times this week already:-) <xsl:variable name="att-name"><xsl:value-of select="name(.)"/></xsl:variable> Dont use xsl:variable with content rather than a selct expression unless you really intend to do this. selct=name() would have made teh variable a string with the name, but as you have it it's a result tree fragment with a root node containing a text node with string value the name. In this case it's just a lot to type and slower to execute but <xsl:variable name="path-name"><xsl:text>@</xsl:text><xsl:value-of select="name(.)"/></xsl:variable> even if you made that a string rather than a result tree fragment it is never going to work select="$path-name" will evaluate to the result tree fragment (or string) '@xxxx' not the result of executing teh Xpath @xxx. This is just the same as C or java or fortran or most other languages if you have a string "x+2" then getting from there to executing that string as a fragment of the language is non trivial and requires writing a parser to parse the string. You could go select="*@[name()=$att-name()] but it seems unlikely that you really want to for-each over all the attributes then have to special case test for each in turn with an xsl:when. I think that you just want to a) start you element b) execute the code that adds all the attributes if no attributes are on your source element c) xsl:apply-templates mode="zzz" select="@*" then you need templates like <xsl:template mode="zzz" match="@margin-right"> <xsl:copy-of select="."/> </xsl:template> David -- http://www.dcarlisle.demon.co.uk/matthew 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