W3C home > Mailing lists > Public > xproc-dev@w3.org > June 2010

Re: variables in xPath statements

From: yamahito <yamahito@gmail.com>
Date: Mon, 21 Jun 2010 09:01:55 -0400
Message-ID: <AANLkTil_x6hyqp4v8uIDcCH6JS1B8bqWcDWCxdfyYzOK@mail.gmail.com>
To: xproc-dev@w3.org
Hi Vojtech,

Did you notice that the ancestorID variable is using the result port of the
loadDocument step?  I'm wanting it to go and look at the original source
document rather than the 'chunk' for precisely the reasons you give here -
or is there another reason that wouldn't work?

Tom

On 21 June 2010 08:52, <Toman_Vojtech@emc.com> wrote:

> > <p:filter select="//div">
> >       <p:input port="source">
> >               <p:pipe port="result" step="loadDocument"/>
> >       </p:input>
> > </p:filter>
> >
> > <p:for-each name="forEachChunk">
> >
> >       <p:variable name="divID" select="/*/@id"/>
> >       <p:variable name="ancestorID"
> > select="//div[@id=$divID]/ancestor::chapter[1]/@id">
> >               <p:pipe port=result" step="loadDocument"/>
> >       </p:variable>
>
> In XProc, the data that you process is always XML documents. That means
> that if you, for instance, use p:filter (or p:input/@select) to extract
> parts of a document, the result you get is always a sequence of
> *documents*.  This is why I think the XPath expression for ancestorID
> fails: "div" is the document element, and therefore there is no ancestor
> "chapter" element.
>
> Hope this helps,
> Vojtech
>
> --
> Vojtech Toman
> Principal Software Engineer
> EMC Corporation
> toman_vojtech@emc.com
> http://developer.emc.com/xmltech
>
>
Received on Monday, 21 June 2010 13:02:33 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 21 June 2010 13:02:33 GMT