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:option name="href" select="/c:file/@name"/>

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


James Garriss

From: Norman Walsh <>
Date: Tue, 30 Sep 2008 14:05:10 -0400
To: XProc Dev <>
Subject: Re: possible bug in p:iteration select
Resent-From: XProc Dev <>
Resent-Date: Tue, 30 Sep 2008 18:05:52 +0000

James Garriss <> writes:
> It returns a list as expected:
> <c:directory xmlns:c="" 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:output port="result"/>
    <p:iteration-source select="//c:file">
      <p:option name="href" select="/c:file/@name"/>

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

> 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,

Norman Walsh <> | Why shouldn't things be largely absurd,            | 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:01:11 UTC