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>

James,

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:load>
     <p:option name="href" select="'/path/to/file.xml'" />
   </p:load>

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

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'  
option.

Make sense?

Jeni
-- 
Jeni Tennison
http://www.jenitennison.com
Received on Tuesday, 30 September 2008 20:12:55 GMT

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