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

Re: XPath shorthand

Subject: Re: XPath shorthand
From: Ihe Onwuka <ihe.onwuka@xxxxxxxxxxxxxx>
Date: Tue, 21 Aug 2012 20:17:50 +0100
Re:  XPath shorthand
On Tue, Aug 21, 2012 at 6:12 PM, Andrew Welch <andrew.j.welch@xxxxxxxxx> wrote:
> On 21 August 2012 17:49, Ihe Onwuka <ihe.onwuka@xxxxxxxxxxxxxx> wrote:
>> I'm assuming/hoping that the positional predicate in the match pattern
>> will curtail the search when the key is being indexed since all I want
>> is a list of element names.
> ...
>>> In the end I went with
>>>
>>> <xsl:key name="desired_fields"
>>> match="m__id[1]|m__name[1]|m__path[1]|m__enabled[1]"
>>> use="local-name()"/>
>>>
>>> and
>>>
>>> following-sibling::*[key('desired_fields',local-name())]
>
> Why do that?
>

Because then all my end-user has to do if he wants to change the
fields being retrieved is add (or subtract) the relevant element name
from the match pattern.

With the other options I have to maintain (and therefore edit) the
list of desired element names in two places (one to control what
templates are applied and one for the following sibling check).

I understand it may not be as performant, but the volumes are not
significant  and the usability feature mentioned is more important.

I amended the match keys so they read match="/descendant::m__id[1] as
my previous effort may have found the first occurrence in every node
set rather than the first in the whole document.

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

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.
Email
First Name
Last Name
Company
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.