XProc - problem using <make-absolute-uris>

Questions about XML that are not covered by the other forums should go here.
Zearin
Posts: 107
Joined: Mon Jul 30, 2007 11:31 pm
Location: College Park, MD, United States

XProc - problem using <make-absolute-uris>

Post by Zearin »

I just started using Xproc, and I am very excited by the features it has to offer. I recently ran into what I *think* is a simple problem. Here's the setup:



I have the combined the outputs of several <directory-list> steps into one document that looks something like the following:

Code: Select all

<directory name="nameOfDir" xml:base="file:/path/to/nameOfDir">
<directory name="anotherDir" xml:base="file:/path/to/nameOfDir/anotherDir">
<file name="name-of-file.ext" />
</directory>

<file name="another-file.ext" />
</directory>
Note the following:
  • all <directory> elements have an @xml:base present, with a properly url-encoded path.
  • unlike the above example…
    • the output is in the namespace xmlns:c="http://www.w3.org/ns/xproc-step". I didn't feel like typing the prefix for the short example above. :)
    • many of my files and directories have spaces and other non-url-friendly characters in their @names. (This does not apply to the value of @xml:base on the <directory>s.)
  • when I attempt to run <make-absolute-uris match="file/@name" /> afterwards, I get a long mess of java IllegalArgumentExceptions. I'm guessing it has to do with the characters that are illegal for URIs, but I'm still new to XProc so I'm not sure how to solve it.
I'm using:
  • Calabash v0.9.14
  • Oxygen v10.3
  • Mac OS X v10.5 (“Leopard”)


I'd be very grateful if someone could point me in the right direction!

I have a feeling the solution to this is probably really simple…but I've already toyed around with various options for a few hours with no luck. :(
-- Zearin
Zearin
Posts: 107
Joined: Mon Jul 30, 2007 11:31 pm
Location: College Park, MD, United States

Re: XProc - problem using <make-absolute-uris>

Post by Zearin »

Nobody?

If I posted the actual code from the file, would that make it easier? Anybody familiar enough with XProc to help?
-- Zearin
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Re: XProc - problem using <make-absolute-uris>

Post by george »

Hi,

We are working on integrated XProc support in oXygen for the next oXygen version so I assume you run Calabash from oXygen as an external tool.
I see you posted this issue also on the xproc mailing list and got no response so far, but I guess the problem was a bad timing as many people (including Norm) were in Montreal at the Balisage conference.
I would suggest creating a very simple pipeline that shows exactly the problem when applied on a simple cut down XML file and post that to the xproc mailing list.

Best Regards,
George
George Cristian Bina
Zearin
Posts: 107
Joined: Mon Jul 30, 2007 11:31 pm
Location: College Park, MD, United States

Re: XProc - problem using <make-absolute-uris>

Post by Zearin »

Here's what's not working:

Code: Select all

<?xml version='1.0' encoding='UTF-8'?>
<?oxygen RNGSchema='file:/Users/tony/Developer/lib/org.w3/xproc.rnc' type='compact'?>
<declare-step
xmlns="http://www.w3.org/ns/xproc"
xmlns:c="http://www.w3.org/ns/xproc-step"
xmlns:cx="http://xmlcalabash.com/ns/extensions">


<input port="source" />
<output port="result" />


<import href="http://xmlcalabash.com/extension/steps/library-1.0.xpl" />



<directory-list path="../Inboxes" exclude-filter=".DS_Store" />


<rename match="/*" new-name="c:hello" />


<for-each name="process-emails">
<iteration-source select="//c:directory" />

<output port="result" primary="true" />

<directory-list exclude-filter=".DS_Store">
<with-option name="path" select="concat('../Inboxes/', c:directory/@name)" />
</directory-list>
</for-each>


<wrap-sequence wrapper="c:emails" />

<!--
HERE is where I want to use <make-absolute-uris />
-->

</declare-step>

I also tried using make-absolute-uris as the last step in the final for-each loop without success.

I'm getting a Java IllegalArgumentException from Calabash's output.

The files are HTML-wrapped emails, and the filenames are the Subject of those e-mails. They include wonky characters, for example: Trampoline Enron Explorer » Email » (no subject).html.

I also tried removing the filename prefix Trampoline Enron Explorer » Email » from all the files with no change in results.
-- Zearin
Mircea
Posts: 131
Joined: Tue Mar 25, 2003 11:21 am

Re: XProc - problem using <make-absolute-uris>

Post by Mircea »

Hello,

Using the following example:

Code: Select all

<?xml version='1.0' encoding='UTF-8'?>
<declare-step
xmlns="http://www.w3.org/ns/xproc"
xmlns:c="http://www.w3.org/ns/xproc-step"
xmlns:cx="http://xmlcalabash.com/ns/extensions">

<input port="source">
<inline>
<c:emails>
<c:directory name="test1"
xml:base="http://www.foo.com/samples/test1/">
<c:file name="Email » 1.xml"/>
</c:directory>
<c:directory name="test2"
xml:base="http://www.foo.com/samples/test2/">
<c:file name="Email » 2.xml"/>
</c:directory>
</c:emails>
</inline>
</input>
<output port="result" />

<make-absolute-uris match="//c:file/@name"
base-uri="http://www.sample.com/"/>
</declare-step>
You can obtain the same IllegalArgumentException as in your case. If the "»" character and the SPACES surounding it are removed the example works fine.
The problem is obviously in the Calabash code, since it seems that URIs are not corrected (spaces and special characters must be escaped).

Please consider posting this problem on the XProc List.

Regards,
Mircea.
Mircea Enachescu
<oXygen> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Post Reply