<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:saxon="http://icl.com/saxon"
+ exclude-result-prefixes="saxon"
version="1.0">
+<!-- Should be base URI for imagedata and so on fixed? -->
+<xsl:param name="profile.baseuri.fixup" select="true()"/>
+
<!-- Copy all non-element nodes -->
<xsl:template match="@*|text()|comment()|processing-instruction()" mode="profile">
<xsl:copy/>
and $revision.ok and $revisionflag.ok and $role.ok and $security.ok
and $userlevel.ok and $vendor.ok and $attribute.ok">
<xsl:copy>
- <xsl:apply-templates select="@*|node()" mode="profile"/>
+ <xsl:copy-of select="@*"/>
+ <!-- Fix base URI of some elements -->
+ <xsl:if test="$profile.baseuri.fixup and (self::textdata or self::imagedata or self::videodata or self::audiodata or self::inlinegraphic or self::graphic)">
+ <xsl:choose>
+ <xsl:when test="@fileref
+ and not(contains(@fileref,':'))
+ and not(starts-with(@fileref,'/'))
+ and function-available('saxon:systemId')">
+ <xsl:attribute name="xml:base">
+ <xsl:call-template name="systemIdToBaseURI">
+ <xsl:with-param name="systemId">
+ <xsl:choose>
+ <!-- file: seems to confuse some processors. -->
+ <xsl:when test="starts-with(saxon:systemId(), 'file:/') and substring(saxon:systemId(), 7, 2) != '//'">
+ <xsl:value-of select="concat('file:///', substring-after(saxon:systemId(), 'file:/'))"/>
+ </xsl:when>
+ <xsl:when test="starts-with(saxon:systemId(), 'file:')">
+ <xsl:value-of select="substring-after(saxon:systemId(),
+ 'file:')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="saxon:systemId()"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="fileref">
+ <xsl:value-of select="@fileref"/>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ <xsl:choose>
+ <xsl:when test="@entityref">
+ <xsl:attribute name="xml:base">
+ <xsl:value-of select="unparsed-entity-uri(@entityref)"/>
+ </xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ <!-- End of base URI fixup -->
+ <xsl:apply-templates select="node()" mode="profile"/>
</xsl:copy>
</xsl:if>
</xsl:template>
version="1.0">
<!-- Include common profiling stylesheet -->
-<xsl:include href="profile-mode.xsl"/>
+<xsl:import href="profile-mode.xsl"/>
+
+<!-- This file must be included, because profile-mode is using templates from it -->
+<xsl:import href="../common/stripns.xsl"/>
+
+<!-- In the two pass processing there is no need for base URI fixup -->
+<xsl:param name="profile.baseuri.fixup" select="false()"/>
<!-- Generate DocBook instance with correct DOCTYPE -->
<xsl:output method="xml"