Re: [xsl] Screening values from two attribute-sets

Subject: Re: [xsl] Screening values from two attribute-sets
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 11 Feb 2004 22:50:15 GMT
I'm not sure why this is a faq but it is (come up several times this
week already:-)
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


even if you made that a string rather than a result tree fragment it is
never going to work


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
start you element
execute the code that adds all the attributes if no attributes are on
your source element
xsl:apply-templates mode="zzz" select="@*"

then you need templates like
<xsl:template mode="zzz" match="@margin-right">
<xsl:copy-of select="."/>



 XSL-List info and archive:

Current Thread