FW: <p:xquery> with inline query?

Confounded reply-to!

-----Original Message-----
From: Piez, Wendell A. (Fed)
Sent: Wednesday, January 22, 2025 10:32 AM
To: Norm Tovey-Walsh <ndw@nwalsh.com>
Subject: RE: <p:xquery> with inline query?

Hello again David and XProc Dev,

First off, apologies for the noise, answering the question already answered. My email was latent.

I can report this works in both XML Calabash 3.0.0-alpha14, and Morgana

<p:xquery>
   <p:with-input port="query">
      <p:inline content-type="text/plain">substring(.,2)</p:inline>
   </p:with-input>
 </p:xquery>

As for the spec, it does explain what rules to follow when XML appears on the port https://spec.xproc.org/3.0/steps/#c.xquery, suggesting also we can do this:

<p:xquery>
   <p:with-input port="query">
      <p:inline><root>{{ substring(.,2) }}</root></p:inline>
   </p:with-input>
</p:xquery>

The result is XML, because the tagged XML going in is also XQuery.

As for the syntax, you might prefer

<p:xquery>
   <p:with-input port="query">
      <p:inline expand-text="false"><root>{ substring(.,2) }</root></p:inline>
   </p:with-input>
</p:xquery>

Comments and corrections gratefully accepted!
Wendell

-----Original Message-----
From: Norm Tovey-Walsh <ndw@nwalsh.com>
Sent: Wednesday, January 22, 2025 9:15 AM
To: David Birnbaum <djbpitt@gmail.com>
Cc: XProc Dev <xproc-dev@w3.org>
Subject: Re: <p:xquery> with inline query?

David Birnbaum <djbpitt@gmail.com> writes:
> the error message changes to:
>
>  Can currently only handle source documents as text/plain, but found:
> application/json

On XML Calabash? That's...odd. I swear I tried it this morning before I replied to your message.

This ought to work as well:

<p:xquery>
  <p:with-input port="query">
     <c:query xmlns:c="http://www.w3.org/ns/xproc-step">
        substring(.,2)
     </c:query>
  </p:with-input>
</p:xquery>

                                        Be seeing you,
                                          norm

--
Norm Tovey-Walsh <ndw@nwalsh.com>
https://norm.tovey-walsh.com/

> Sometimes I think we're alone. Sometimes I think we're not. In either
> case, the thought is staggering.--R. Buckminster Fuller

Received on Wednesday, 22 January 2025 15:32:48 UTC