W3C home > Mailing lists > Public > public-xml-processing-model-comments@w3.org > February 2010

Re: multiple inputs in test expressions?

From: Henry S. Thompson <ht@inf.ed.ac.uk>
Date: Fri, 05 Feb 2010 11:06:20 +0000
To: fikin <nikolai.fiikov@gmail.com>
Cc: public-xml-processing-model-comments@w3.org
Message-ID: <f5btytwvt5f.fsf@calexico.inf.ed.ac.uk>
-----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 11:06:52 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 5 February 2010 11:06:52 GMT