[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Screening values from two attribute-sets

Subject: Re: Screening values from two attribute-sets
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 11 Feb 2004 22:50:15 GMT
re screening
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:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.