Re: [xsl] CSS and XSLT, again

Subject: Re: [xsl] CSS and XSLT, again
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Tue, 6 Feb 2001 09:31:55 +0000
Hi Shimon,

> Yes, Michael, this is what I do (I actually load CSS file and
> include its text in between <style>), but I thought this way is
> awkward. I thought there is a way to "import" style into xsl file
> like "include" for asp pages (if we are talking about IIS)

Well, you could use the traditional XML way of declaring an entity and
then importing that:

<?xml version="1.0"?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY style SYSTEM 'style.css'>
]>
<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

<xsl:template match="/">
   <html>
      <head>
         <title>...</title>
         <style>
            &style;
         </style>
      </head>
      <body>
         ...
      </body>
   </html>
</xsl:template>

...

</xsl:stylesheet>

The advantage of this over using document() to pull in the CSS file is
that you don't have to wrap the CSS in an element - you can just have
the CSS file as normal CSS text.

No doubt eventually you'll be able to use XInclude (see
http://www.w3.org/TR/xinclude) or perhaps even XLink instead but I
don't think that any of the XSLT processors/XML parsers support this
at the moment.

I hope that helps,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread