[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: An approach to let XML 2.n resources hold multiple entitie
In a message dated 19/03/2003 09:46:17 GMT Standard Time, bill.dehora@p... writes: > At the moment, count(/*) always is 1. I am suggesting redefining / Bill, I think you may be conflating a couple of ideas here. Yes it is possible to have processing instructions or comments in the prolog before the start tag of the document element. However XPath 1.0 treats each such processing instruction or comment as a node, rather than treating the prolog as a child of the root node. The location path count(/*) will return all child nodes of the principal node type for the default (child) axis. The element node is the principal node type, so the location path count(/*) returns 1 since there is only ever one child element node of the root node in a well-formed XML document. However, count(/node()) returns all child nodes of the root node (not just those of the principal node type). If, as in the following example document, there are non-element child nodes of the root node then count(/node()) will return a value greater than 1. In this case 3. <?xml version="1.0"?> <?arbitrary processing instruction ?> <!-- Some comment which is a child of the root node --> <document> <child> </child> </document> Andrew Watt
|
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
|