RE: Question about self axis

Firstly, I'm not sure why you're using this list, or which version of which
W3C spec you are commenting on.

But in both XPath 1.0 and XPath 2.0, and therefore also in XQuery 1.0, "*"
only selects nodes of the principal node kind for the axis, and the
principal node kind for the self axis is elements. So self::* selects
nothing when the context node is an attribute. self::node(), however, would
select the attribute.

Not a particularly nice result, but it's a well-documented XPath 1.0 quirk
and not the kind of thing one can easily change.

Michael Kay

# -----Original Message-----
# From: www-xpath-comments-request@w3.org 
# [mailto:www-xpath-comments-request@w3.org] On Behalf Of Kirmse, Daniel
# Sent: 19 March 2004 08:41
# To: www-xpath-comments@w3.org
# Subject: Question about self axis
# 
# 
# Hi,
# 
# suppose following document (X-Hive example):
# 
# <?xml version="1.0" encoding="ISO-8859-1"?>
# <ma:AuctionWatchList 
# xmlns:ma="http://www.example.com/AuctionWatch" 	
# xmlns:xlink="http://www.w3.org/1999/xlink" 	
# xmlns:anyzone="http://www.example.com/auctioneers#anyzone" 	
# xmlns:eachbay="http://www.example.com/auctioneers#eachbay" 	
# xmlns:yabadoo="http://www.example.com/auctioneers#yabadoo">
#   <ma:Auction anyzone:ID="0321K372910">
# ...
# 
# and consider this XQuery:
# 
# //ma:Auction/@anyzone:ID/self::*
# 
# In my understanding this should yield:
# 
# anyzone:ID="0321K372910"
# 
# because the NameTest "*" matches the attribute name, as well 
# as self::*:*, self::*:ID, self::anyzone:* and self::anyzone:ID.
# 
# Is that right? Can one say that each node that has a 
# node-name no matter what type of node it is, would yield a 
# similar result?
# 
# Thanks & Cheers,
# Daniel     
#  
# 
# 

Received on Friday, 19 March 2004 04:05:07 UTC