Hi,
I discovered this same problem when I started working on generating a CSS file and creating the links to it. I was also surprised it had not come up before. I'm planning to fix it in the next release.

Bob Stayton
Sagehill Enterprises
[email protected]


----- Original Message ----- From: "Paul Millar" <[email protected]>
To: <[email protected]>
Sent: Thursday, December 10, 2009 7:37 AM
Subject: [docbook-apps] 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>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]





---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to