Subject: Re: set union? xslt 2.0
From: Dave Pawson <davep@xxxxxxxxxxxxx>
Date: Thu, 8 Apr 2010 10:42:20 +0100
|
On Thu, 08 Apr 2010 10:25:48 +0100
David Carlisle <davidc@xxxxxxxxx> wrote:
>
> <xsl;template
> select="skillarea[tokenize(@targets,'|')=tokenize($param,'|')]"/>
>
> if you're worried about repeatedly tokenizing the attributes probably
> you can optimise this with a key or some such, or perhaps saxon will
> optimise for you behind the scenes or perhaps it's fast enough anyway.
No problem with speed.
<grin/> Guess you mean
<xsl:template
match="skillarea[tokenize(@targets,'|')=tokenize($param,'|')]"/>
This is the 'odd' meaning of = in xslt 2?
If any item on LHS is present in RHS then = returns true.
Issue:
What happens with tokenize when the separator is missing?
empty set?
Resolve using if contains(@target,'|') then tokenize.... else ...
Getting rather messy since either could be a list.
I think this idea would work without a separator?
param = "term1 term 2"
@target="term1 oddone"
Would the equality work then? Currently strings, is this a case
where a sequence is needed?
--
regards
--
Dave Pawson
XSLT XSL-FO FAQ.
http://www.dpawson.co.uk
|