[Home] [By Thread] [By Date] [Recent Entries]

  • From: "Michael Kay" <mike@s...>
  • To: "'Rens Duijsens'" <rens.duijsens@g...>,<xml-dev@l...>
  • Date: Tue, 26 Aug 2008 14:44:28 +0100

XPath coding questions are better asked on the xsl-list at mulberrytech.com
 
Please see the following example:
<ROOT>
    <ELEMENT>Element 1</ELEMENT>
    <NODE>
        <ELEMENT>Element 2</ELEMENT>
        <ELEMENT>Element 3</ELEMENT>
    </NODE>
</ROOT>

The normal xpath statement '//NODE' will give me:
NODE, ELEMENT (with Element 2), ELEMENT (With Element 3)  

Actually, no, it only gives you one element: NODE. You can reach all the other nodes from there, but they are not selected by the XPath expression. Your development environment might choose to display NODE by showing it along with its children, but that's not part of the action of the XPath expression itself.  

I'm experimenting with some inverted statements:
For instance: /*[!//NODE] or //*[!//NODE]  

Please don't experiment with syntax. You'll never work out how XPath works by a [expletive deleted]-it-and-see approach. Read the spec, or a good book.

 
It keeps giving me the NODE data as well.  

Both the above are syntax errors and should give you nothing but an error message. 

The inverted selection *should* produce:
ROOT, ELEMENT (With Element 1)
Any advice on how to put the statement together?

Since you've explained the effect of the correct statement incorrectly, I'm really not sure what you actually want to select.

Michael Kay

http://www.saxonica.com/



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member