[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Dealing with relative CSS files in chunked output
[apologies if this is the wrong mailing list] Hi all, I noticed an issue with chunked web output and CSS. I'm using v1.75.2 of the style-sheets (the Debian package is docbook-xsl 1.75.2+dfsg-3). The issue is that, if the CSS file-name is relative and some of the chunked output goes into subdirectories then the generated HTML has a broken link to the CSS file. This is because it doesn't take into account that one (or more) "../" prefixes are needed. I searched around but this didn't seem to be a known issue, which surprises me. I've included a rather ugly work-around below that customises the output.html.stylesheets template. It is roughly based on the href.target in html/chunk-common.xsl. This work-around doesn't provide support for multiple CSS files and absolute URIs (which is OK for my use), but might be insufficient for others. I include it here in case it's useful for someone. Cheers, Paul. --- <!-- Work-around issue with chunking and having a relative CSS filename --> <xsl:template name="output.html.stylesheets"> <xsl:variable name="depth"> <xsl:call-template name="count.uri.path.depth"> <xsl:with-param name="filename"> <xsl:call-template name="href.target.uri"> <xsl:with-param name="object" select="."/> </xsl:call-template> </xsl:with-param> </xsl:call-template> </xsl:variable> <xsl:variable name="href"> <xsl:call-template name="copy-string"> <xsl:with-param name="string" select="'../'"/> <xsl:with-param name="count" select="$depth"/> </xsl:call-template> <xsl:value-of select="$html.stylesheet"/> </xsl:variable> <link rel="stylesheet" href="{$href}"> <xsl:if test="$html.stylesheet.type != ''"> <xsl:attribute name="type"> <xsl:value-of select="$html.stylesheet.type"/> </xsl:attribute> </xsl:if> </link> </xsl:template>
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]