xsl-list
[Top] [All Lists]

Re: [xsl] set union? xslt 2.0

2010-04-08 05:14:43
On 08/04/2010 10:42, Dave Pawson wrote:
On Thu, 08 Apr 2010 10:25:48 +0100
David Carlisle<davidc(_at_)nag(_dot_)co(_dot_)uk>  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,'|')]"/>


well you can either filer on the match as you have it there, or on the select in teh apply-templates, personal taste.


This is the 'odd' meaning of = in xslt 2?

As Martin said, it's the same as the meaning in XSLT 1.

It's fairly natural to have implicit quantification since the basic type in xpath is a set 9xpat 10 or sequence (xpath 2) rather than singltons.


If any item on LHS is present in RHS then = returns true.

That's a rather non symmetric way of describing it.


Issue:
   What happens with tokenize when the separator is missing?
empty set?

no you get a single token, the whole string.

   Resolve using if contains(@target,'|') then tokenize.... else ...
Getting rather messy since either could be a list.

so don't do that then:-)

I think this idea would work without a separator?
param = "term1 term 2"
@target="term1 oddone"

that's exacty the same but using space instead of | as separator. You can use any character you like so ling as that character never appears in the token. Note though you may need extra levels of quoting in command line to get spaces into a parameter, but then the same might be true of | as that is also a special character to unix commandline shells (at least).


Would the equality work then? Currently strings, is this a case
where a sequence is needed?

After you have tokenized there is no record of how the sequence was constructed, so equality works the same way. Or perhaps i misunderstood the question.

David



________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. ________________________________________________________________________

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>