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">
            <doc xml:base="file:/tmp/"/>
    <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:input port="parameters">
        <p:input port="stylesheet">
                <xsl:stylesheet xmlns:xsl="
http://www.w3.org/1999/XSL/Transform" version="2.0">
                    <xsl:template match="/">
                        <xsl:copy-of select="/"/>
    <p:add-attribute match="/*" attribute-name="base-after">
        <p:with-option name="attribute-value" select="base-uri(/*)"/>

Gives me this on the output port:

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

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)

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

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:17:10 UTC