Adapting relative links to match the structure of the browsable archive

This commit is contained in:
Eric van der Vlist 2012-04-28 22:29:43 +02:00
parent bf2980567a
commit bc581fabf9
2 changed files with 4 additions and 2 deletions

View File

@ -49,7 +49,8 @@
<xsl:matching-substring> <xsl:matching-substring>
<xsl:text>url(</xsl:text> <xsl:text>url(</xsl:text>
<xsl:variable name="abs" select="substring-before(concat(resolve-uri(regex-group(1), $base), '#'), '#')"/> <xsl:variable name="abs" select="substring-before(concat(resolve-uri(regex-group(1), $base), '#'), '#')"/>
<xsl:value-of select="$index/resource[(uri, same-as) = $abs]/local-name"/> <xsl:variable name="local-name" select="$index/resource[(uri, same-as) = $abs][1]/local-name"/>
<xsl:value-of select="if ($local-name) then concat('../', $local-name) else resolve-uri(regex-group(1), $base)"/>
<xsl:text>)</xsl:text> <xsl:text>)</xsl:text>
</xsl:matching-substring> </xsl:matching-substring>
<xsl:non-matching-substring> <xsl:non-matching-substring>

View File

@ -58,7 +58,8 @@
<xsl:template match="link[@rel='stylesheet']/@href|img/@src|script/@src"> <xsl:template match="link[@rel='stylesheet']/@href|img/@src|script/@src">
<xsl:attribute name="{name(.)}"> <xsl:attribute name="{name(.)}">
<xsl:variable name="abs" select="substring-before(concat(resolve-uri(., $base), '#'), '#')"/> <xsl:variable name="abs" select="substring-before(concat(resolve-uri(., $base), '#'), '#')"/>
<xsl:value-of select="$index/resource[(uri, same-as) = $abs]/local-name"/> <xsl:variable name="local-name" select="$index/resource[(uri, same-as) = $abs][1]/local-name"/>
<xsl:value-of select="if ($local-name) then concat(if ($resource/uri/@seed = 'false') then '../' else '', $local-name) else resolve-uri(., $base)"/>
</xsl:attribute> </xsl:attribute>
</xsl:template> </xsl:template>
<xsl:template match="link[@rel!='stylesheet']/@href|a/@href"> <xsl:template match="link[@rel!='stylesheet']/@href|a/@href">