Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   XML (http://www.velocityreviews.com/forums/f32-xml.html)
-   -   XSLT questions: CSS and encoding (http://www.velocityreviews.com/forums/t169552-xslt-questions-css-and-encoding.html)

petermichaux@yahoo.com 07-06-2005 05:07 AM

XSLT questions: CSS and encoding
 
Hi,

I would like to know if I'm linking a CSS file in and XSLT file the
most efficient way. Below is how I'm doing it.

Also how can I make it so that the resulting XHTML file will be encoded
in ISO-8859-1? Currently the XHTML file output by this tranformation is
in charset=UTF-8.

Thanks,
Peter


<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" indent="yes"/>

<xsl:template match="/">
<html lang="en">
<head>
<title>XSLT Catalog Template</title>
<link href='css/store.css' type='text/css'
rel='stylesheet'/>
<link href='css/catalog.css' type='text/css'
rel='stylesheet'/>
</head>
<body>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>

<xsl:template match="//category">
<h1><xsl:value-of select="name"/></h1>
<h2><xsl:value-of select="description"/></h2>
</xsl:template>

<xsl:template match="//product">
<h2><xsl:value-of select="name"/> - <xsl:value-of
select="description"/></h2>
</xsl:template>

</xsl:stylesheet>


Joris Gillis 07-06-2005 07:15 AM

Re: XSLT questions: CSS and encoding
 
Hi,

Tempore 07:07:41, die Wednesday 06 July 2005 AD, hinc in foro {comp.text.xml} scripsit <petermichaux@yahoo.com>:

> I would like to know if I'm linking a CSS file in and XSLT file the
> most efficient way. Below is how I'm doing it.


The method you use is very common. I suspect most browsers would choke on other methods (processing-instructions).

> Also how can I make it so that the resulting XHTML file will be encoded
> in ISO-8859-1? Currently the XHTML file output by this tranformation is
> in charset=UTF-8.


Just specify add an 'encoding' attribute to the 'xsl:output' element.

regards,
--
Joris Gillis (http://users.telenet.be/root-jg/me.html)
Spread the wiki (http://www.wikipedia.org)

petermichaux@yahoo.com 07-06-2005 03:30 PM

Re: XSLT questions: CSS and encoding
 
Thanks for the reply.

What are the other methods for linking a css file
(processing-instructions)? I am using server-side XSLT so maybe
processing instructions are a better way of doing it.

Thanks again,
Peter


Joris Gillis 07-06-2005 03:54 PM

Re: XSLT questions: CSS and encoding
 
Tempore 17:30:52, die Wednesday 06 July 2005 AD, hinc in foro {comp.text.xml} scripsit <petermichaux@yahoo.com>:

> Thanks for the reply.
>
> What are the other methods for linking a css file
> (processing-instructions)? I am using server-side XSLT so maybe
> processing instructions are a better way of doing it.


A processing instruction such as this
<?xml-stylesheet type="text/css" href="mycss.css"?>
can be used to style up any xml document, in this case XHTML.

But, CSS stylesheets are handled on the (unreliable) client, no matter if your XSLT engine can ouput it. To avoid a fuss with MIME-types, I'd just use the standard 'link' element.

regards,
--
Joris Gillis (http://users.telenet.be/root-jg/me.html)
Spread the wiki (http://www.wikipedia.org)


All times are GMT. The time now is 11:11 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.