Solved

link .css in XSL doesn't show supposed effect

Posted on 2014-03-01
5
368 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
In this tutorial viewers will learn how to customize the background color and font color of highlighted text using the ::selection element in CSS Begin by defining the selected text as an element in CSS by typing "::selection": Style the ::selection…
In this tutorial viewers will learn how to style rounded corners for elements in CSS using the border-radius property Begin with a normal styled element such as a div: To style all four corners of the div to be the same degree of roundness, use the …

828 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