Re: HTTP client module

Florent Georges <[email protected]> Wed, 21 Jan 2009 18:33:23 +0100 (CET)
Newsgroups gmane.text.xml.xslt.extensions
Message-ID <[email protected]>
"M. David Peterson" wrote:

> Haha! I kid! ;-) Of course I believe this is also the source of
> the confusion: I read "This parameter can be an
> |xsl:output|element" and think of the string value of
> xsl:output/@name as what it refers to whereas I can easily see
> and understand why thinking if XQuery terms you would read it
> as the XML literal <xsl:output ... /> embedded inline.

  And passing an xsl:output element is not only useful in XQuery,
but also in XSLT.  If you can only pass a name, you have to know
the whole set of output definition you wold need.  By allowing
passing an xsl:output itself, you can now construct it at
evaluation time:

    <xsl:namespace-alias stylesheet-prefix="a" result-prefix="xsl"/>
    ...

    <xsl:variable name="output-def" as="element(xsl:output)">
       <a:output method="xml" indent="{
           if ( do indent? ) then 'yes' else 'no' }"/>
    </xsl:variable>

> Using the above example, how would you propose using lazy
> evaluation to avoid consuming the resources required to parse
> the response and return it to the calling extension method in
> cases where that data provides no meaningful benefit to the
> current task at hand?

  In the above example, http:send-request() would return a
sequence whose the first item is the http:response element, and
the second and last item is a document-node(element(atom:entry)).
If I understand John correctly, lazy evaluation would result in
never building the document node if you never try to access it.

  But as I said, that's maybe putting to much hopes in an
extension function capabilities?

> > I think you misunderstand - I'm wondering if it should be
> > changed to be optional.

> I don't think I'm misunderstanding. I agree: Setting it as
> optional ensures the ability to treat an escaped HTML string as
> something that should either be serialized to HTML as-is w/o
> first tidying it or rendered in its escaped form.

  I am lost here.  We are not talking about serialization, but
parsing.

> > What I mean is, if I have an item of type xs:base64Binary,
> > how can I send that as a binary payload in an HTTP request.

> As part of the /http:request/http:multipart/http:header|http:body
> elements.

  Almost :-).  As content of http:body (in http:request or
http:multipart) or as the $content param.

  Regards,

-- 
Florent Georges
http://www.fgeorges.org/