RE: with-option and other XPath Expressions - Prevent streaming from being possible (??)

Hi,

I'm a bit of a newbie with XProc and I just started looking at p:with-option
yesterday. The following pipeline might represent a simple test case.

<p:pipeline>
    <!-- use the default input source -->
    <p:add-attribute match="//div[@class='section']" attribute-name="id" >
        <p:with-option name="attribute-value" select="concat('section_',
position())"/>
    </p:add-attribute>
</p:pipeline>

With this source:

<html>
  <head>
    <title>Topic 01</title>
  </head>
  <body>
    <h1>Topic 01</h1>
    <div class="section">
      <h2>T01 - Section 1</h2>
      <p>Content 01</p>
    </div>
    <div class="section">
      <h2>T01 - Section 2</h2>
      <p>Content 02</p>
    </div>
    <div class="section">
      <h2>T01 - Section 3</h2>
      <p>Content 03</p>
    </div>
  </body>
</html>

Expecting this result:

<html>
  <head>
    <title>Topic 01</title>
  </head>
  <body>
    <h1>Topic 01</h1>
    <div class="section" id="section_1">
      <h2>T01 - Section 1</h2>
      <p>Content 01</p>
    </div>
    <div class="section" id="section_2">
      <h2>T01 - Section 2</h2>
      <p>Content 02</p>
    </div>
    <div class="section" id="section_3">
      <h2>T01 - Section 3</h2>
      <p>Content 03</p>
    </div>
  </body>
</html>

I'm not there yet but I understand the spec better every day. Thanks in
great part to this list.

The above was inspired by looking at add-attribute-002.xml, so maybe it
could become add-attribute-003.xml.


Regards,
Raymond

-----Original Message-----
From: xproc-dev-request@w3.org [mailto:xproc-dev-request@w3.org] On Behalf
Of Toman_Vojtech@emc.com
Sent: Monday, December 08, 2008 9:38 AM
To: xproc-dev@w3.org
Subject: RE: with-option and other XPath Expressions - Prevent streaming
from being possible (??)


> One interesting data point
> I looked at all the published "required" tests use of p:with-option
> Not a single one of them used a context sensitive expression 
> (out of 42 
> p:with-option uses).
> Atleast not that I could find.

By the way, there are a couple of recent tests that do this now:
  base-uri-001.xml
  base-uri-002.xml
  preserve-base-uri-001.xml

I agree, it may not be convincing at all, but at least have some tests
that use context sensitive p:with-option. And I am sure we will have
more (as a matter of fact, I am writing one myself at the moment :)

Regards,
Vojtech

Received on Tuesday, 9 December 2008 08:09:03 UTC