Solved

link .css in XSL doesn't show supposed effect

Posted on 2014-03-01
5
355 Views
Last Modified: 2014-04-05
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?
0
Comment
Question by:ethar1
  • 3
  • 2
5 Comments
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 39898283
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
0
 

Author Comment

by:ethar1
ID: 39898711
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
0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 39898893
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
0
 

Author Comment

by:ethar1
ID: 39904517
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.
0
 
LVL 60

Accepted Solution

by:
Geert Bormans earned 500 total points
ID: 39979749
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
In this tutorial viewers will learn how to style different bullet points for unordered lists in CSS. Begin with a normal unordered list; the default bullet point is a solid circle: In the CSS, create a defined class of unordered list by typing "ul.S…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now