W3C home > Mailing lists > Public > xproc-dev@w3.org > September 2008

Re: possible bug in p:iteration select

From: James Garriss <james@garriss.org>
Date: Tue, 30 Sep 2008 16:07:40 -0400
To: Norman Walsh <ndw@nwalsh.com>, XProc Dev <xproc-dev@w3.org>
Message-ID: <C507FF4C.BF2%james@garriss.org>
What I (instinctively) want to do is this:

    <p:for-each>
        <p:output port="result"/>
        
        <p:iteration-source select="//c:file"/>
        <p:variable name="filename" select="//@name)"/>
        <p:load href="$filename"/>
    </p:for-each>

But Calabash ain't buying that either.  :-)  That's probably my XSLT
background squeaking through.

James Garriss
http://garriss.blogspot.com




From: James Garriss <james@garriss.org>
Date: Tue, 30 Sep 2008 16:00:20 -0400
To: Norman Walsh <ndw@nwalsh.com>, XProc Dev <xproc-dev@w3.org>
Conversation: possible bug in p:iteration select
Subject: Re: possible bug in p:iteration select

Ok, I see the idea:  to load documents, I need to use p:load.  But how you
used p:load left me confused.  This code doesn't seem right:

    <p:load>
      <p:option name="href" select="/c:file/@name"/>
    </p:load>

The href is a URI.  //c:file/@name is an XPath expression, attempting to
read the value of the "name" attribute.  Aren't we mixing apples and
oranges?

TIA,

James Garriss
http://garriss.blogspot.com




From: Norman Walsh <ndw@nwalsh.com>
Date: Tue, 30 Sep 2008 14:05:10 -0400
To: XProc Dev <xproc-dev@w3.org>
Subject: Re: possible bug in p:iteration select
Resent-From: XProc Dev <xproc-dev@w3.org>
Resent-Date: Tue, 30 Sep 2008 18:05:52 +0000

James Garriss <james@garriss.org> writes:
[...]
> It returns a list as expected:
>
> <c:directory xmlns:c="http://www.w3.org/ns/xproc-step" name="albums">
> <c:file name="beautiful_new.xml"/>
> <c:file name="considering_lily.xml"/>
> <c:file name="i_2_(EYE).xml"/>
> </c:directory>
>
> So I add a p:for-each with a p:iteration-source to enable me to process each
> XML file:
>
>     <p:for-each>
>         <p:output port="result"/>
>
>         <p:iteration-source select="//c:file/@name"/>
>         <p:identity/>
>     </p:for-each>
>
> Pipeline failed: org.xproc.XProcException:
> net.sf.saxon.s9api.SaxonApiException: Cannot create an attribute node (name)
> whose parent is a document node

There error message is a bit awkward, but the problem *is* that you're
trying to create an attribute node as a document.

What you want is something more like this:

  <p:for-each>
    <p:output port="result"/>
    <p:iteration-source select="//c:file">
    <p:load>
      <p:option name="href" select="/c:file/@name"/>
    </p:load>
    <p:identity/>
  </p:for-each>

Unfortunately, that doesn't work in Calabash 0.6.3. All I can do is
repeat my promise to try to get an 0.6.4 out this week that fixes this
bug.

> It seems that XProc is trying to *create* an attribute instead of *reading*
> the value of the attribute.
>
> Is that a bug?

No :-)

                                        Be seeing you,
                                          norm

-- 
Norman Walsh <ndw@nwalsh.com> | Why shouldn't things be largely absurd,
http://nwalsh.com/            | futile, and transitory? They are so,
                              | and we are so, and they and we go very
                              | well together.-- Santayana
Received on Tuesday, 30 September 2008 20:08:26 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 30 September 2008 20:08:26 GMT