Subject: Re: [xsl] set union? xslt 2.0 From: David Carlisle <davidc@xxxxxxxxx> Date: Thu, 08 Apr 2010 11:14:14 +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.
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).
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?
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.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] set union? xslt 2.0, Dave Pawson | Thread | Re: [xsl] set union? xslt 2.0, Dave Pawson |
Re: [xsl] set union? xslt 2.0, Andrew Welch | Date | Re: [xsl] set union? xslt 2.0, Dave Pawson |
Month |