W3C home > Mailing lists > Public > public-xml-processing-model-wg@w3.org > March 2007

Re: Parameter handling

From: Henry S. Thompson <ht@inf.ed.ac.uk>
Date: Wed, 28 Mar 2007 14:40:41 +0100
To: Norman Walsh <Norman.Walsh@Sun.COM>
Cc: public-xml-processing-model-wg@w3.org
Message-ID: <f5br6r9trja.fsf@hildegard.inf.ed.ac.uk>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Yeah, there's a missing functionality -- we talked at one point about
generalising 'replace' and 'set-attributes' with something you might
call 'set-value', with args an xpath to select a domain, an xpath to
select a target relative to that, and an xpath to select a value. . .

Then you could do:

<p:set-value>
 <p:option name="domain" value="c:body"/>
 <p:option name="target" value="."/>
 <p:option name="value" value="$parm"/>
 <p:input port="source">
  <p:inline>
    <c:http-request method="post" href="http://example.com/form-action">
      <c:entity-body content-type="application/x-www-form-urlencoded">
        <c:body>[will be replaced]</c:body>
      </c:entity-body>
    </c:http-request>
   </p:inline>
 </p:input>
</p:set-value>

You could of course also do it with the equivalent bit of XSLT:

<p:xslt>
 <p:parameter name="content" value="$parm"/>
 <p:input port="source">
  <p:inline>
    <c:http-request method="post" href="http://example.com/form-action">
      <c:entity-body content-type="application/x-www-form-urlencoded">
        <c:body>xyzzy</c:body>
      </c:entity-body>
    </c:http-request>
   </p:inline>
 </p:input>
</p:set-value>
<p:input port="stylesheet">
 <xsl:ss>
  <xsl:template match="node()|@*"/>
    <xsl:copy>
     <xsl:apply-templates select="node()|@*"/>
    </xsl:copy>
  </xsl:template>
  <xsl:template match="c:body">
   <xsl:copy>
    <xsl:apply-templates select="@*"/>
     <xsl:value-of select="$content"/>
    </xsl:apply-templates>
   </xsl:copy>
  </xsl:template>
 </xsl:ss>
</p:input>
</p:xslt>

Richard may have something to add about a tool we use in Edinburgh to
make it trivial to do a streaming step which only handles this sort of
stylesheet.

ht
- -- 
 Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
                     Half-time member of W3C Team
    2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
            Fax: (44) 131 650-4587, 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)

iD8DBQFGCnBZkjnJixAXWBoRApJLAJ45kl1mTg8+/P5bcowbOxzBHJte7gCdG61l
GuDlw3a4cuQPPbAbPuuGeNA=
=bfIC
-----END PGP SIGNATURE-----
Received on Wednesday, 28 March 2007 13:40:46 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:21:50 GMT