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 Sunday, 3 August 2025 15:31:32 UTC