|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Efficient XPath 2.0 expression to return each <row> e
Hi Folks,
I have a large XML document containing data about airports around the world:
<airports>
<row>
<navaid>A</navaid>
</row>
<row>
<navaid>B</navaid>
</row>
<row>
<navaid>A</navaid>
</row>
</airports>
Notice that there is only one <row> element having the B navaid, but two <row>
elements having the A navaid.
I want an XPath 2.0 expression to return each <row> element for which there
are other <row> elements having the same navaid. For the above example, I want
the XPath expression to return the first and third <row> elements.
Here is one way to do it:
//row[navaid = (preceding-sibling::row/navaid,
following-sibling::row/navaid)]
Eek! That is horribly inefficient. I ran that XPath expression on my XML
document and it took a long time to finish.
Is there an efficient XPath 2.0 expression to solve this problem?
Note: I am running the XPath expression from Oxygen's XPath evaluator, not
from an XSLT program.
/Roger
|
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
|

Cart








