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

Re: set union? xslt 2.0

Subject: Re: set union? xslt 2.0
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 08 Apr 2010 11:14:14 +0100
Re:  set union? xslt 2.0
On 08/04/2010 10:42, Dave Pawson wrote:
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,'|')]"/>


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. ________________________________________________________________________


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.