W3C home > Mailing lists > Public > xproc-dev@w3.org > March 2013

Preserving the base URI through a p:xslt transformation

From: Jostein Austvik Jacobsen <josteinaj@gmail.com>
Date: Fri, 22 Mar 2013 10:50:39 +0100
Message-ID: <CAOCxfQfEv_RjkOitH2_HU0-LhHgMVRXjrKrtWMeg39N3yqrYZg@mail.gmail.com>
To: XProc Dev <xproc-dev@w3.org>
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

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:03:10 UTC