Re: multiple inputs in test expressions?

thanks for the hint, it is certainly a way to go about it.

the problem i have here is with string-join(). it is xpath2 and and not 
even mentioned in exslt too.

and using xslt1 instead would only lead us to more code ...

and if using xpath2 processor,
why would not use collection() directly or bind implicitly all inputs to 
variable names in the test expression?


Henry S. Thompson wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> The following makes use of an old hack, and will do what you need w/o
> merging your docs.  You may consider it too ugly to use in practice, I
> wouldn't blame you :-)
>
> Note I've gone to all this trouble because I'm _assuming_ that both
> source and src2 have many 'tag' daughters of 'tags', each with a
> name.
>
> ht
>
> <p:declare-step xmlns:p="http://www.w3.org/ns/xproc" name="top"
> version="1.0">
>  <p:input port="source" primary="true"/>
>  <p:input port="src2"/>
>  <p:output port="result"/>
>  <p:variable name="src2name"
> select="concat('|',string-join(/tags/tag/@name,'|'),'|')">
>   <p:pipe step="top" port="src2"/>
>  </p:variable>
>  
>  <p:choose>
>   <p:when test="some $name in /tags/tag/@name satisfies
> contains($src2name,concat('|',$name,'|'))">
>    <p:identity>
>     <p:input port="source">
>      <p:inline><r>win</r></p:inline>
>     </p:input>
>    </p:identity>
>   </p:when>
>   <p:otherwise>
>    <p:identity>
>     <p:input port="source">
>      <p:inline><r>lose</r></p:inline>
>     </p:input>
>    </p:identity>
>   </p:otherwise>
>  </p:choose>
>
> </p:declare-step>
> - -- 
>        Henry S. Thompson, School of Informatics, University of Edinburgh
>                          Half-time member of W3C Team
>       10 Crichton Street, Edinburgh EH8 9AB, SCOTLAND -- (44) 131 650-4440
>                 Fax: (44) 131 651-1426, e-mail: ht@inf.ed.ac.uk
>                        URL: http://www.ltg.ed.ac.uk/~ht/
> [mail really from me _always_ has this .sig -- mail without it is forged spam]
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.6 (GNU/Linux)
>
> iD8DBQFLa/uskjnJixAXWBoRAuYhAJ4iLC67XN96MaSPDxhtRY8V+c++JwCfWiSd
> fZkv9GOJFxt++PMR4HGZy1E=
> =JqZX
> -----END PGP SIGNATURE-----
>
>   

Received on Friday, 5 February 2010 12:09:41 UTC