Re: [xsl] embad css in in xsl

Subject: Re: [xsl] embad css in in xsl
From: "Joris Gillis" <roac@xxxxxxxxxx>
Date: Wed, 09 Mar 2005 13:15:36 +0100
Tempore 00:09:30, die 03/09/2005 AD, hinc in xsl-list@xxxxxxxxxxxxxxxxxxxxxx scripsit henry human <henry_human@xxxxxxxx>:

is that possible to define format of element in a xsl
stylesheet (embad css Stylesheet like in html head)?

Hi,


There are two ways to interpret your question.
1) you want to display the xsl document itself by means of an css stylesheet


Just like in any xml document, you can add reference to stylesheets:
consider this XSLT:

<?xml-stylesheet type="text/css" href="test.css"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:output method="xml" indent="yes" />


<xsl:template match="root">
xsl code
</xsl:template>

</xsl:stylesheet>

and a css file , named 'test.css', containing:

@namespace xsl url(http://www.w3.org/1999/XSL/Transform);
xsl|template {color: red}

Then the XSL document could be rendered as a string 'xsl code' in red.

2) you want to embed css rules in your output document.

Just make the necessary elements be added to the result tree:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:output method="html" indent="yes" />


<xsl:template match="root">
<html>
	<head>
		<style type="text/css">
			/*css rules here*/
		</style>
	</head>
	<body>
		<p>test</p>
	</body>
</html>
</xsl:template>

</xsl:stylesheet>


regards, -- Joris Gillis (http://www.ticalc.org/cgi-bin/acct-view.cgi?userid=38041) Fiat W3C in tenebris

Current Thread