Preserving the base URI through a p:xslt transformation

So this pipeline:

<?xml version="1.0" encoding="UTF-8"?>
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" version="1.0">
    <p:input port="source">
        <p:inline>
            <doc xml:base="file:/tmp/"/>
       </p:inline>
    </p:input>
    <p:output port="result"/>
    <p:delete match="/*/@xml:base"/>
    <p:add-attribute match="/*" attribute-name="base-before">
        <p:with-option name="attribute-value" select="base-uri(/*)"/>
    </p:add-attribute>
    <p:xslt>
        <p:input port="parameters">
            <p:empty/>
        </p:input>
        <p:input port="stylesheet">
            <p:inline>
                <xsl:stylesheet xmlns:xsl="
http://www.w3.org/1999/XSL/Transform" version="2.0">
                    <xsl:template match="/">
                        <xsl:copy-of select="/"/>
                    </xsl:template>
                </xsl:stylesheet>
            </p:inline>
        </p:input>
    </p:xslt>
    <p:add-attribute match="/*" attribute-name="base-after">
        <p:with-option name="attribute-value" select="base-uri(/*)"/>
    </p:add-attribute>
</p:declare-step>

Gives me this on the output port:

<doc base-after="file:/home/jostein/preserve-base-test.xpl"
base-before="file:/tmp/"/>

I would like to get this:

<doc base-after="file:/tmp/" base-before="file:/tmp/"/>

How can I make an XSLT transformation preserve the base URI of the document
without using the xml:base attribute?

(I'm not sure if this is an XSLT question or if it's related to how XProc
handles base URIs)

Jostein

Received on Friday, 22 March 2013 09:51:27 UTC