[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Is this node, the document root... best test?
Steve,
At 12:46 PM 10/20/2003, you wrote: I'm not sure what's holding up my posts (I see responses before I see my post ;-) but, I'm not sure these tests are very meaningful ... I suspect there are many variables in play besides those that you're testing, including which processor you are using. In any case, the test ". = /" is not a dependable test: it tests true if the value of the context node is the same as the value of the root node, which will be the case for both the root node and the document element, and sometimes for other elements as well, as in: <hey> <this> <is>nuts</is> </this> </hey> The values of the root, of the <hey>, <this> and <is> elements are all the same: "nuts". So .=/ tests true for all these cases. So, by "document root" do you mean the actual root of the XPath tree representation of an XML document, or the "document element", namely that element that contains all the others, sometimes called the "root element" in XML? test="parent::*" will test false for either the document root or the document element, even though the document element is a child of the root. This is because the primary node type of the parent axis is an element, and neither of these nodes have an element parent. test="parent::node()" will test true for the document element (it has a parent, namely the root node) but not for the root node (which has no parent). Cheers, Wendell
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|