[url=http://"http://www.coderanch.com/t/125529/XML/xpath-exp-conventions-or-just"]Continuing my earlier thread[/url].... I have yet another question on selecting a node using the "." dot. This is what I have read in a paper and it is true. Could somebody explain me the rule for selecting the variable "b"...please. Thanks. XML File:
The result file:
Sorry for the long post, just wanted to be detailed... The rule for "SET B" is based on: <xsl:variable name="b" select="/Root/Numbers/Integer/@value[. > 2]" /> What is being selected here by the use of "."? Is it the value of attribute "value" ?
Thanks for any help. - madhav [ January 24, 2003: Message edited by: Madhav Lakkapragada ]
knock....knock...kncok.... Can somebody please explain.... <xsl:variable name="b" select="/Root/Numbers/Integer/@value[. > 2]" /> What is being selected here by the use of "."? Is it the value of attribute "value" ?
. is used to refer to the current context node which is the attribute so this xpath rule selects both the elements:- value =4 and value = 3 you can get very help tools like xpath explorer from purple technology which show you the result of an xpath expression
"....bigmouth strikes again, and I've got no right to take my place with the human race...."<p>SCJP 1.4
Joined: Dec 10, 2002
and this xpath rule will select the Integer elements that have a value attribute with value > 2
/Root/Numbers/Integer[@value > 2] selects:- the two Integer elements with values 3 and 4 xpath tool available at: -
Thanks, Steve. For whatever reason, I always thought, "." can only select "elements" not "attributes". I guess I alaways assume that a "Node" in DOM is equal to an "Element" in XML, which is wrong. - madhav