|
Subject: Re: [xsl] XPath shorthand From: Andrew Welch <andrew.j.welch@xxxxxxxxx> Date: Tue, 21 Aug 2012 20:28:42 +0100 |
>>>> 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.
..in which case:
<xsl:variable name="names" select="('m__id', 'm__name',
'm__path'....)" as="xs:string+"/>
with
following-sibling::*[local-name() = $names]
is the same but doesn't require the key, however you should really
take into account namespaces.
--
Andrew Welch
http://andrewjwelch.com
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] XPath shorthand, Ihe Onwuka | Thread | Re: [xsl] XPath shorthand, Ihe Onwuka |
| Re: [xsl] XPath shorthand, Ihe Onwuka | Date | [xsl] The Holy Trinity of Functiona, Costello, Roger L. |
| Month |