Link to home
Start Free TrialLog in
Avatar of ethar turky
ethar turkyFlag for Saudi Arabia

asked on

link .css in XSL doesn't show supposed effect

Dear all,
I generate some html using xml and xsl ,
I need to use .CSS files , I add references to .css file on my xsl file like this:
<xsl:text disable-output-escaping='yes'>&lt;!DOCTYPE html></xsl:text>
<html>
  <head>

<link href="http://fonts.googleapis.com/css?family=Open+Sans:600,400" rel="stylesheet" type="text/css" media="screen" />
<link href="http://xxx.org/css/bootstrap.css" rel="stylesheet" type="text/css" media="screen" />
<link href="http://xxx.org/css/font-awesome.min.css" rel="stylesheet" type="text/css" media="screen" />
<link href="http://xxx.org/css/tinyscrollbar.css" rel="stylesheet" type="text/css"   media="screen"  />

Open in new window


but there is no effect on the output, I can c the link to stylesheets but there is no effect on the output html.
any solution?
Avatar of Gertone (Geert Bormans)
Gertone (Geert Bormans)
Flag of Belgium image

Hi, you need to give us more information.
How do you do the XSLT? Serverside or clientside?
There are some possible issues client side because the DOM does not always reload causing the elements not always being connected to the right CSS properties

If you are pushing the XML, make sure you have the mimetype set right

If you do this server side, make sure your serialisation is set to html

It feels uncorrect that you have a doctype hacked in other than using the right serialisation settings. I feel you need to do that in order to avoid the system and public identifier to be required. I would go for a clean approach with doctype public attributes

Best approach for getting the correct result on a server transform is debugging the result html and make sure it works and then works towards that correct endresult

When serving, always make sure that you serve it up with the correct mimetype
Avatar of ethar turky

ASKER

Thanks for your reply
I use C# XslCompiledTransform Transform(xmlReader, argsList, xmlWriter)

can I add the css in the c# code?

How do you do the XSLT? server side or client side?
> server side

If you are pushing the XML, make sure you have the mimetype set right
what do you means? about the mimetype the site can easily display the css style if I browse any other page ( or html page ).

If you do this server side, make sure your serialization is set to html
How to make sure my serialisation  is set to html?

It feels uncorrect that you have a doctype hacked in other than using the right serialization settings.
Do you means I should remove the DocType from XSL?

thanks
On debugging, make sure your XSLT transformation result is rendered correctly by a browser.
So save the transformation result as a file (you most likely need to twiddle a bit after that)
or test your XSLT in an IDE

about the serialisation.
I believe you can tell the C# serialiser to resoect the settings of the xsl:outpul
XmlWriterSettings ws = xslt.OutputSettings.Clone();

make the xsl:output method="html"

are you doing html5?
If not, I would suggest to have real doctype references
about the serialisation.
I believe you can tell the C# serialiser to resoect the settings of the xsl:outpul
XmlWriterSettings ws = xslt.OutputSettings.Clone();
Could you please descript or refer to a url.
ASKER CERTIFIED SOLUTION
Avatar of Gertone (Geert Bormans)
Gertone (Geert Bormans)
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial