RE: use-when and debugging

Welcome Sheila,

I get a lot of flexibility from setting static options in Morgana from a file by the way

<mox:static-options xmlns:mox="http://www.xml-project.com/morganaxproc">
    <mox:option name="debug" value="false" />
</mox:static-options>

With -statics=... referencing the static options file on the CLI

Might be more flexible to drive from ant
Assuming Calabash might have something similar

Best regards

Geert



-----Original Message-----
From: Sheila Thomson <discuss@bluegumtree.com> 
Sent: Sunday, 3 August 2025 19:46
To: list.mu@c-moria.com
Subject: Re: use-when and debugging

Thanks Geert.  I was doing two things wrong:

1. I hadn't declared the option as static

2. Once I'd declared the option as static, with Morgana I needed to change the way that I passed the argument through from the command-line (-static:debug=xxx instead of -option:debug=xxx)

Knowing that you had it working pushed me to dig deeper :) Again, thank you.

Sheila

On 03/08/2025 17:11, list.mu@c-moria.com wrote:
> Hi Sheila
>
> Yes, you will need a static option
>
> https://spec.xproc.org/3.1/xproc/#use-when
>
> The value of the attribute must contain an XPath expression that can 
> be evaluated statically (See Section 11.3, “Static Options”.)
>
> https://spec.xproc.org/3.1/xproc/#statics
>
> That is exactly what I do for this use case, passing in the value for 
> the static options from the command line
>
> Best
>
> Geert Bormans
>
>
>
> -----Original Message-----
> From: Sheila Thomson <discuss@bluegumtree.com>
> Sent: Sunday, 3 August 2025 17:31
> To: xproc-dev@w3.org
> Subject: use-when and debugging
>
> Hi,
>
> During the XProc user group meeting at Markup UK we discussed storing intermediate results as a debugging aid.  A few people asked why I was using a custom step for this rather than @use-when on the p:store.  Since then I've been experimenting with @use-when, trying to see if I can get that approach working but, as far as I can tell, it will only ever work with a hard-coded value.  Am I missing something?
>
> I commonly call XProc pipelines from an ANT script so that I can easily toggle between using Morgana and Calabash using a single command-line property and at the same time, if I want to debug, I pass in another argument for that, for example:
>
> $> $ ant karaoke-playlist -Dscratchpad.xproc-processor=calabash
> -Dscratchpad.debug=true
>
> The value of scratchpad.debug gets passed through to an XProc parameter named "debug":
>
> <p:option name="debug" select="false()" as="xs:boolean" />
>
> Even when I run an XProc pipeline without ANT, I still want to toggle the value of $debug dynamically, from the command-line, rather than editing the XProc file.
>
> Am I right in thinking that the following will never work if $debug is a p:option unless that option is static?
>
> <p:store ... use-when="$debug" />
>
> And that my next best options thus still remain either wrapping each 
> p:store in <p:if test="$debug"> or, as I have been doing, a re-usable 
> custom step that contains the p:store wrapped in the p:if, so that I 
> only need to write <u:save-debug-snapshot href=".."  debug="{$debug}" 
> />
>
> Does anyone do anything significantly differently to save their intermediate results when debugging?
>
> Sheila
>
>
>
>
>
>
>
>

Received on Monday, 4 August 2025 15:08:46 UTC