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

Re: possible bug in p:iteration select

From: Jeni Tennison <jeni@jenitennison.com>
Date: Tue, 30 Sep 2008 21:12:19 +0100
Cc: Norman Walsh <ndw@nwalsh.com>, XProc Dev <xproc-dev@w3.org>
Message-Id: <A49C5795-9D9E-4065-96D6-FA9E2BBDEDE2@jenitennison.com>
To: James Garriss <james@garriss.org>


On 30 Sep 2008, at 21:00, James Garriss wrote:
> 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?

If you had a known URI, you'd do:

     <p:option name="href" select="'/path/to/file.xml'" />

Note the single quotes around the URI. That's because the select  
attribute on <p:option> is evaluated as an XPath expression to give  
the URI. So you have to use single quotes to indicate it's a string.

In the case where you have an XML document that holds the information,  
you need to point XProc at the relevant attribute or element using an  
XPath expression. In your case, the name attribute on the <c:file>  
element holds the URI, so you use:

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

The XPath expression is evaluated to give a string (the value of the  
name attribute), and that's the value that's passed to the 'href'  

Make sense?

Jeni Tennison
Received on Tuesday, 30 September 2008 20:12:55 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:03:03 UTC