[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] XSL/HTML styling and CSS style sheets


Subject: Re: [xsl] XSL/HTML styling and CSS style sheets
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Thu, 4 Dec 2003 15:27:33 +0000

Hi Jackson,

> I am a newbie to XSL.  My first XSL project is to try to turn one of
> my html pages into an XML/XSL page and I am trying to figure out how
> to make my page look the same way it did when it was just html.  I
> was kinda hoping that I could just embed my CSS the same way I used
> to in the html page:
>
> <link rel="stylesheet" type="text/css" href="/styles.css">
>
> But this doesn?t work.

In what way doesn't it work? All that XSLT does is allow you to create
the HTML page from XML rather than the HTML page being static; the
HTML page that you create using XSLT should otherwise look exactly the
same as the original HTML page, including any <link> element, and then
work in exactly the same way in terms of styling.

Perhaps you're getting an error because you've tried to include the
above tag in your XSLT stylesheet without closing it? Remember that
the XSLT stylesheet must be a well-formed XML document, which means
all the tags must have closing tags. When the XSLT generates an HTML
document (using the html output method), any elements that shouldn't
have a close tag (such as the <link> element) will be serialized
without a close tag.

So try:

<xsl:template match="/">
  <html>
    <head>
      <title>TEST</title>
      <link rel="stylesheet" type="text/css" href="/styles.css" />
    </head>
    ...
  </html>
</xsl:template>

Cheers,

Jeni

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


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



Current Thread
Keywords