Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CSS and XSL?

Status
Not open for further replies.

jmswe

Programmer
Feb 14, 2002
31
GB
Is it true that you cant refer an external .css file from the xsl file?

Do you have to manually copy over all the css tags you want to use into the .xsl document?

If so whats the rationale for this? If you have 100 xsl file and want to make a style change you have to edit 100 documents? Thats like going back to 1995 (or something) again.

Does anyone know?
 
No, I just use a standard <link> element in the XSL file.

e.g.

<link href=&quot;../~worldcup2002/style/WorldCup2002.css&quot; rel=&quot;stylesheet&quot;>


 
File: importStylesheet.xsl

<?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;yes&quot;?>
<xsl:stylesheet xmlns:xsl=&quot; version=&quot;1.0&quot;>

<xsl:template name=&quot;javascript&quot;>
<SCRIPT language=&quot;JavaScript&quot; src=&quot;../your.js&quot; type=&quot;text/javascript&quot;>
<xsl:text> </xsl:text>
</SCRIPT>
</xsl:template>

<xsl:template name=&quot;css&quot;>
<LINK rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;../your.css&quot;>
<xsl:text> </xsl:text>
</LINK>
</xsl:template>
</xsl:stylesheet>

******************************************************

in all other XSL:

<xsl:import href=&quot;importStylesheet.xsl&quot;/>

an when you need:
<HEAD>
<xsl:call-template name=&quot;javascript&quot;/>
<xsl:call-template name=&quot;css&quot;/>
</HEAD>

Now you have to change only one file.

harry
 
If your output method is HTML in your XSL file, just use the <link> tag, but be sure to close it at the end:

<html>
<head>
<title>Your document</title>
<link rel=&quot;stylesheet&quot; href=&quot; rel=&quot;stylesheet&quot; />
</head>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top