RE: Referencing an XProc variable in p:split-sequence/@test

Quite counter-intuitive to my humble opinion..

:-/

> -----Oorspronkelijk bericht-----
> Van: vojtech.toman@emc.com [mailto:vojtech.toman@emc.com]
> Verzonden: maandag 7 mei 2012 16:06
> Aan: xproc-dev@w3.org
> Onderwerp: RE: Referencing an XProc variable in p:split-sequence/@test
>
> Hi Florent,
>
> You cannot refer to a variable in p:split-sequence as the 'test' XPath
expression
> is evaluated using the step XPath context (no variable bindings
available). A
> solution is to do something like this:
>
> <p:split-sequence>
>   <p:with-option name="test" select="concat(' name(/*) eq
'",$elem,"')"/>
> </p:split-sequence>
>
> Regards,
> Vojtech
>
> --
> Vojtech Toman
> Consultant Software Engineer
> EMC | Information Intelligence Group
> vojtech.toman@emc.com
> http://developer.emc.com/xmltech
>
>
> > -----Original Message-----
> > From: fgeorges@gmail.com [mailto:fgeorges@gmail.com] On Behalf Of
> > Florent Georges
> > Sent: Monday, May 07, 2012 3:40 PM
> > To: XProc Dev
> > Subject: Referencing an XProc variable in p:split-sequence/@test
> >
> >   Hi,
> >
> >   I have the following pipeline, which returns as expected the
> > document with element 'one' as result:
> >
> >     <p:declare-step xmlns:p="http://www.w3.org/ns/xproc"
> >                     xmlns:c="http://www.w3.org/ns/xproc-step"
> >                     name="pipeline"
> >                     version="1.0">
> >
> >        <p:input port="source" sequence="true" primary="true">
> >           <p:inline>
> >              <one/>
> >           </p:inline>
> >           <p:inline>
> >              <two/>
> >           </p:inline>
> >        </p:input>
> >
> >        <p:output port="result" sequence="true" primary="true"/>
> >
> >        <p:split-sequence test="name(/*) eq 'one'"/>
> >
> >     </p:declare-step>
> >
> >   If I replace the above split sequence step with the following (that
> > is, simply creating a variable to get the name of the element out of
> > the XPath expression itself):
> >
> >     <p:variable name="elem" select=" 'one' ">
> >        <p:empty/>
> >     </p:variable>
> >     <p:split-sequence test="name(/*) eq $elem"/>
> >
> > then I get the following error:
> >
> >     SEVERE: Underlying exception: net.sf.saxon.trans.XPathException:
> >     Undeclared variable in XPath expression: $elem
> >
> >   From my reading, using an XProc variable in a p:split-sequence/@test
> > expression is allowed.  Did I miss something, or is it a bug in
> > Calabash? (latest Github content for Saxon 9.4+)
> >
> >   Regards,
> >
> > --
> > Florent Georges
> > http://fgeorges.org/
> > http://h2oconsulting.be/
> >
>

Received on Monday, 7 May 2012 14:09:21 UTC