I had some problems with base-uri(.) in the inline XSLT resolving against
the XProc document itself so I just added <p:add-xml-base all="true"
relative="false"/> instead and used the d:file/@xml:base attribute. I agree
using the base-uri(.) syntax would be more elegant, but can the base uri of
an element really be different than its @xml:base attribute? (talking about
d:file/@xml:base here, not d:fileset/@xml:base)

Jostein


On 15 February 2013 14:35, Romain Deltour <notifications@github.com> wrote:

> In fileset-utils/src/main/resources/xml/xproc/fileset-add-ref.xpl:
>
> > +    <p:import href="http://xmlcalabash.com/extension/steps/library-1.0.xpl"/>
> > +
> > +    <!--TODO awkward, add the entry with XProc, then perform URI cleanup-->
> > +    <p:add-xml-base all="true" relative="false"/>
> > +    <p:xslt name="href-uri">
> > +        <p:with-param name="href" select="$href"/>
> > +        <p:with-param name="ref" select="$ref"/>
> > +        <p:input port="stylesheet">
> > +            <p:inline>
> > +                <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:pf="http://www.daisy.org/ns/pipeline/functions" version="2.0" exclude-result-prefixes="#all">
> > +                    <xsl:import href="http://www.daisy.org/pipeline/modules/file-utils/xslt/uri-functions.xsl"/>
> > +                    <xsl:param name="href" required="yes"/>
> > +                    <xsl:param name="ref" required="yes"/>
> > +                    <xsl:template match="/*">
> > +                        <d:ref>
> > +                            <xsl:for-each select="d:file[pf:normalize-uri(resolve-uri(@href,@xml:base)) = pf:normalize-uri(resolve-uri($href,@xml:base))][1]">
>
> I found out it's always safer to resolve against base-uri(.) than @xml<https://github.com/xml>:base,
> we never know how the grammar will evolve.
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/daisy-consortium/pipeline-modules-common/pull/2/files#r3028556>.
>
>