Add a css link to xhtml files that I cannot modify using an XSLT?
According to my programming supervisor I should be able to link a css file to an xhtml开发者_如何学C file that I cannot touch by using an XSLT. How is this achieved? Does anyone have any good ideas? How do I "run" an XSLT? Do I open it in a browser?
I need to basically format an xhtml page so that it fits properly onto a mobile device, but I cannot control or modify the xhtml page coming in (its just basic xhtml).
How do I link these xhtml pages to a .css?
Sorry if it sounds confusing, any clarification questions I will be happy to answer.
Thanks in advance.
XSLT is for transforming xml into html/xhtml. this is because xml is only data. there many different ways to access or display data from an xml, like PHP and XSLT.
So to be clear XSLT can NOT be "RUN". you can think of it as css for xml. XSLT is supported by all major browsers, so there shouldn't be any problems.
you can transform your xml into html/xhtml by linking to it at the begining of the xml file. the best is right after the <?xml version="1.0" encoding="utf-8"?>
you link to it link with this code
<?xml-stylesheet type="text/xsl" href="file.xsl"?>
you can learn about XSLT at this link. doesn't take long to get through.
http://www.w3schools.com/xsl
to link a css file to an html/xhtml file is very simple.
<link rel="stylesheet" type="text/css" href="file.css">
if you are looking to make a html/xhtml file look different to mobile user then it is to desktop users, you can use media="" ( http://www.w3schools.com/tags/att_style_media.asp ). i do not recommend this because most html/xhtml pages are coded to work with a certain css file.
hope this helps!
精彩评论