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

Re: Test for node name and attribute value

Subject: Re: Test for node name and attribute value
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 30 Nov 2004 12:01:42 GMT
xsl test node name
  I am stuck with the following node set expression.
  In an external document I want to find the element which name is
  'anchor' and which attribute @name has the value
  of the variable $anchor.

If I understand you correctkly you just want

<xsl:variable name="anchor-node"select="$external-doc//anchor[@name=$anchor]"/>

I in your code fragments you seem to have switched to looking for name
my-anchor rather than anchor.

3 <xsl:variable name="anchor-node" select="$external-doc//node()[name()
= 'my-anchor' and @name = $anchor]" />

that is legal but there is no need to select all nodes withg node() then
filter out those with name my-anchor, you could just do

3 <xsl:variable name="anchor-node" select="$external-doc//my-anchor[@name = $anchor]" />

which is more or less as above.

 <xsl:variable name="anchor-node" select="$external-doc//node()[name()
= 'my-anchor' and @name = @anchor]" />
or
 <xsl:variable name="anchor-node" select="$external-doc//my-anchor[@name = @anchor]" />

is also legal but tests the anchor attribute of the my-anchor element in
$external-doc is equal to the name attribute on the smae element.

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. 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.