[XML-DEV Mailing List Archive Home]
[By Thread]
[By Date]
[Recent Entries]
[Reply To This Message]
RE: How to 'invert' an Xpath statement please
- 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]
|
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
RSS 2.0 |
 |
Atom 0.3 |
 |
|
Stylus Studio has published XML-DEV in RSS and ATOM formats,
enabling users to easily subcribe to the list from their preferred news reader application.
|
Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website.
they were not included by the author in the initial post. To view the content without the Sponsor Links please
click here.
|
|