- From: Norman Walsh <ndw@nwalsh.com>
- Date: Fri, 12 Dec 2008 09:15:39 -0500
- To: XProc Dev <xproc-dev@w3.org>
- Message-ID: <m2vdtp1nuc.fsf@nwalsh.com>
"Dave Pawson" <dave.pawson@gmail.com> writes: >>From http://www.w3.org/TR/xproc/#c.xslt > it is not obvious which 'parameters' (xml child elements) > are optional, which are required. Parameters suck. The WG tried on several occasions to find a way to get rid of them, but we couldn't. Simply removing them would have made it impossible to pass parameters to XSLT stylesheets, which would have made XProc far, far less useful. > <p:xslt name="trsf"> > <p:input port='stylesheet'> > <p:document href="step1.xsl"/> > </p:input> > </p:xslt> > > Is resulting in an error > Pipeline failed: err:XS0055: Parameter input parameters unbound on > p:xslt step named trsf and no default binding available. > > Why is the parameter parameter 'required' seemingly? It's a port, a special kind of port. It has different binding rules that (often) make life simpler for authors. But not always. Here's how it works. 1. If you don't specify a binding for the 'parameter' port, then it binds by default to the parameter port of the pipeline that contains it. This way, parameters you pass to the pipeline automatically get passed to the steps that can use them. 2. If there is no binding for a parameter input port on the top level pipeline (the one that you start executing first), then it automatically gets bound to an empty document. 3. If you declare your pipeline with <p:pipeline>, you get a parameter input port by default and things "just work". 4. But if you declare your pipeline with <p:declare-step>, as I usually do, then you have to either remember to provide a parameter input port explicitly: <p:declare-step ...> <p:input port="parameters" kind="parameter"/> <p:input port="source"/> ... Or you have to remember to explicitly provide a binding when you use the XSLT step: <p:xslt> <p:input port="parameters"> <p:empty/> </p:input> ... Like I said, they suck. > I'm guessing this relates to params passed to the xslt processor? Yep. Be seeing you, norm -- Norman Walsh <ndw@nwalsh.com> | One's never alone with a rubber duck. http://nwalsh.com/ |
Received on Friday, 12 December 2008 14:16:24 UTC