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

Re: can you select name() of attributes?

Subject: Re: can you select name() of attributes?
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 27 Jul 2004 10:51:41 +0100
select name
> I think it drops down to the following: can you select name() of attributes in 
> a select attribute in an xsl element?

yes

as for any node

select="name(/foo/bar/@baz)"

will return the name of the selected node ("baz") in thi scase.

> <xsl:variable name="Attr" select="$Doc/@*"/> which selects all attributes in 
> the Doc variable (which are text values as far as I know...?)

No. That selects attribute nodes not text values.


> I want to be able to use the name of the attributes in the same way as a 
> reqular nodeset, 

well tough, it's a string not a node set:-)

> where I can say node-A=nodeset-B which in a nodeset is true 
>if just one node in nodeset-B is equal to node-A.

As MK says most days you can do this in XPath 2 but not in Xpath 1
howver you can do it in xslt 1.

If you have two sets of attributes, eg

<xsl:variable name="Attr1" select="$Doc1/@*"/>
<xsl:variable name="Attr2" select="$Doc2/@*"/>


Then you want something like:


<xsl:for-each select="$Attr1">
 <xsl:for-each select="$Attr2[name()=name(current())]">
this is in Attr and Attr2: <xsl:value-of select="name()"/>
 </xsl:for-each>
</xsl:for-each>
David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

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.
Email
First Name
Last Name
Company
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.