I don’t understand why this test
count(.|../@*)=count(../@*)
( from Dave Pawson’s Home page )
identify an attribute node 🙁
could someone give me a detailled explanation ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
A few things to understand:
.refers to the current node (aka “context node”)|) never duplicates nodes, i.e.(.|.)results in one node, not twoself::axis you could use in theory (e.g.self::*works to find out if a node is an element), butself::@*does not work, so we must use something differentKnowing that, you can say:
../@*fetches all attributes of the current node’s parent (all “sibling attributes”, if you will)(.|../@*)unions the current node with them – if the current node is an attribute, the overall count does not change (as per #3 above)count(.|../@*)equalscount(../@*), the current node must be an attribute node.