Re: xproc as an alternative to Apache ant

Thanks Vojtech.

2009/5/25  <>:

> For example, consider this params.xml document:
> <c:param-set xmlns:c=''>
>  <c:param name='testname1' value='testvalue1'/>
>  <c:param name='testname2' namespace=""
> value='testvalue2'/>
> </c:param-set>

OK so it does stand alone with c:param-set as the root element.

Now can I 'build' on them, as Apache ant does?
 <c:param name='testname1' value='testvalue1'/>
<c:param name='testname2'  value='${testname1}/dir/dir/file.ext'/>

> You can then pass it to the parameter input port of this pipeline:

Singular? I.e. there is only one parameter input port?
Implies I can't have multiple 'imported' variable definitions?
My use case was
1 file for common values (paths etc)
1 file for 'hidden' items, e.g. user names, passwords etc.

I think you provide the answer below.

> <p:declare-step name="main" xmlns:p="">
>  <p:input port="parameters" kind="parameter"/>
>  <p:output port="result" sequence="true"/>
>  <p:parameters name="parameters">
>    <p:input port="parameters">
>      <p:pipe step="main" port="parameters"/>
>    </p:input>
>  </p:parameters>

Is the input port 'parameters' the only link between the step
and the param-set?
Why no
<c:param-set  name="param1"

or an href on the step that calls up the param-set?
(I guess we are 'abusing' the idea of parameters by
treating them like variables as per xslt)

>  <!-- "result" is not primary on p:parameters -->
>  <p:identity>
>    <p:input port="source">
>      <p:pipe step="parameters" port="result"/>
>    </p:input>
>  </p:identity>
> </p:declare-step>

Guessing, this is simply copying the param-set to the output port?

> Or, you can read it in the pipeline using the p:document binding:
> <p:declare-step xmlns:p="">
>  <p:output port="result" sequence="true"/>
>  <p:parameters name="parameters">
>    <p:input port="parameters">
>      <p:document href="params.xml"/>
>    </p:input>
>  </p:parameters>

Ah! That's what I wanted!
So this refers to an explicit (external) parameters file!

Next question, how do I refer to the values set in
the external file? Is there some syntax for this?

E.g. I want to run an XSLT transform using
parameter $xslt_stylesheet as the stylesheet for the transform.

> An interesting thing about parameters in XProc is that if you provide
> the same parameter multiple times, only the last value will be used. You
> could use this mechanism for overriding the previous
> (default/inherited/...) parameter value if you want:

Neat. Same principle as XSLT?

Seems I still have more questions than answers Vojtech!

I do wish I could 'read' W3C specs (and understand them)


Dave Pawson
Docbook FAQ.

Received on Monday, 25 May 2009 07:41:17 UTC