[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: What is the most efficient XPath expression for r

Subject: Re: What is the most efficient XPath expression for retrieving the first child element?
From: "Michael Kay mike@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 12 May 2019 12:11:21 -0000
Re:  What is the most efficient XPath expression for  r
Well, it depends on the implementation, of course.

For Saxon, child::*[1], though child::Total_Size[1] will only take a
nanosecond or two longer. Avoid child::TotalSize, because this will search all
the children (it doesn't know there is only one).

Michael Kay

> On 12 May 2019, at 12:43, Costello, Roger L. costello@xxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
> Hello XSLT experts!
> I want to retrieve the first child element. The children consist of a
<Total_Size> element followed by many <String> elements (perhaps thousands of
<String> elements).
> <COFF_String_Table>
>    <Total_Size>4443</Total_Size>
>    <String>.eh_frame</String>
>    <String>.debug_aranges</String>
>    <String>.debug_info</String>
>    ...
> </COFF_String_Table>
> Question: What is the most efficient XPath for selecting the first child
element (the <Total_Size> element)? Assume the context node is the
<COFF_String_Table> element. Which of these is the most efficient XPath
> (a) child::*[1]
> (b) child::Total_Size
> (c) something else (what?)
> /Roger

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.