W3C home > Mailing lists > Public > xproc-dev@w3.org > November 2011

RE: The file name for the output of an xsl:result-document

From: Geert Josten <geert.josten@dayon.nl>
Date: Thu, 3 Nov 2011 16:34:31 +0100
Message-ID: <0ae051f227f9eea7cf58ececb3666147@mail.gmail.com>
To: David Cramer <david@thingbag.net>, XProc Dev <xproc-dev@w3.org>
Hi David,

AVTs are indeed not supported, unfortunately. You will have to use
p:with-output for passing in a variable as well.

<p:store>
    <p:with-option name="href" select="$output-wadl"/>
</p:store>

The second store doesn't work, because resolve-uri only prepends a base if
the first argument represents a relative path. By supplying base-uri(/*)
you are passing in an absolute path, so resolve-uri won't work. You can
grab the last part of the path using a replace:

replace(base-uri(/*), '^(.*/)?([^/]+)$', '$2')

Kind regards,
Geert

-----Oorspronkelijk bericht-----
Van: David Cramer [mailto:david@thingbag.net]
Verzonden: donderdag 3 november 2011 15:43
Aan: XProc Dev
Onderwerp: Re: The file name for the output of an xsl:result-document

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Thanks Geert and Vojtech,

At the top of the file I've tried various versions of:

<p:variable name="input-base" select="p:base-uri(/*)"/>
<p:variable name="output-wadl"
select="p:resolve-uri('foo.xml',$input-base)"/>

Then to store the main result document, I want to use the value of
variable, but clearly AVTs aren't the way to do it:

<p:store href="{$output-wadl}"/>

Likewise, for the documents on the secondary port, using resolve-uri
(or p:resolve-uri) doesn't have any effect:

<p:with-option name="href"
select="resolve-uri(base-uri(/*),$input-base)"/>

I've put the whole listing here:

http://pastebin.com/3dQzsQ2b

What am I doing wrong?

I feel like I'm struggling with very basic things. Aside from the
spec, is there a good xproc reference or tutorial that would help with
these questions? I've googled up a few things, but nothing that that
seems comprehensive. The best thing I've found so far is:
http://www.xfront.com/xproc/

Thanks,
David

On 11/03/2011 06:09 AM, Geert Josten wrote:
> Hi David,
>
> Sounds like you want to put a p:variable at the top of your
> pipeline/declare-step, do the base-uri(/) or base-uri(/*) there.
> That takes the base-uri of the input, instead of the generated
> output. Then use resolve-uri('foo.xml', $input-base-uri) to get a
> path for foo.xml in the input folder..
>
> Kind regards, Geert
>
> -----Oorspronkelijk bericht----- Van: David Cramer
> [mailto:david@thingbag.net] Verzonden: donderdag 3 november 2011
> 3:06 Aan: Geert Josten CC: XProc Dev Onderwerp: Re: The file name
> for the output of an xsl:result-document
>
> Thanks Geert. That helped. Using p:log, I learned that
> base-uri(/*) causes the files land in my home directory with their
> appropriate file names.
>
> Now I just need to figure out how to say in xproc "In the same
> directory as the source document" (or in some dir passed in from
> Oxygen anyway). E.g. here:
>
> <p:store href="concat(???, '/', 'foo.xml')"/>
>
> and here:
>
> <p:with-option name="href" select="concat( ???, '/',
> p:base-uri(/*))"/>
>
> Though I could be going about it all wrong.
>
> Thanks, David
>
> On 11/01/2011 04:10 PM, Geert Josten wrote:
>> Hi David,
>
>> Bit of a guess here, but have you tried base-uri(/*) ?
>
>> Kind regards, Geert
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJOsqhrAAoJEMHeSXG7afUhGacIAJyM+Uagx7XZLC0C5pPrn8yo
rsvqEiI66t1GYetNBH3mx64FptrTtKA6AGDtkNNiKQwYY2qHqSsRB9Wo3O6OqDx6
huiEXhfjF2o337Ej8KaiQ4ElBTQ6L7Y0eXXVQGYSqyowTgqNiL4svzZi5t+Ut7AF
L8h6rk9/mUIBMHJudafSKzWkM4yIQqP60h3tieqU2WNQ2uB9HopH7qLwg6qCVc1b
Rg64L7o7vZNdGzAtpAgQ4y8NXAB+/8iRVvgQyJJUCzhwkpJ8FAk5dOEDKnLC5VtY
qpJBAGyLphoiFr6lT28ZN/5U4hv9nkAp1nLl66SwiQoFHRw2OSPvl0nciUs0mgE=
=J4gq
-----END PGP SIGNATURE-----
Received on Thursday, 3 November 2011 17:53:04 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 3 November 2011 17:53:13 GMT