XSLT? Is this what I want? (Meh, forget it.)
We have a program that generates some nice XML documents every time it runs.
Occasionally, we want to format the document and view it / print it out.
We are looking at using a browser to view and print the documents.
XLS/XLST seemed to be our best bet. However, I'm finding that most of the
XLST examples are still using some pretty basic HTML commands.
Is there some sort of fancy acronym that I can use to provide HTML documents with CSS type styling, with our XML data?
I've been working with XML, but mostly as a data source for back-end programs, not as a feed for browsers, so I'm a little out of my league with this.
Re: XSLT? Is this what I want?
Anything that can be done with HTML/CSS and even Javascript can be output using XSLT.
Re: XSLT? Is this what I want?
You can embed CSS and Javascript inside the HTML output. Ensure that you use CDATA escaping however. It is best to use links rather than embed scripts and stylesheets inside the HTML.
Re: XSLT? Is this what I want?
Okay. Great. I need all that good stuff.
Anyone have any examples to an XSLT using a linked CSS file?
Re: XSLT? Is this what I want? (Yes it is, help!)
Just incude:
HTML Code:
<link rel="stylesheet" type="text/css" href="path/to/css.css" />
And to include Javascripts:
HTML Code:
<script type="text/javascript" src="path/to/javascript.js"></script>
Re: XSLT? Is this what I want? (Yes it is, help!)
Yeah. I think I got it.
It's just kinda confusing with taking my xml, transforming it with xslt, as an output of html that uses classes from a css file.
Not only that, but the xslt file has to incorporate about 6 sightly different xml formats. I better start writing things down...
Re: XSLT? Is this what I want? (Yes it is, help!)
I'd actually suggest XQuery over XSLT, it's more flexible and you have more control over what you're doing.
Re: XSLT? Is this what I want? (Yes it is, help!)
Quote:
Originally Posted by mendhak
I'd actually suggest XQuery over XSLT, it's more flexible and you have more control over what you're doing.
Could you explain xQuery? I have a whole chapter on it in my book, but cannot be bothered to read it :D
Re: XSLT? Is this what I want? (Yes it is, help!)
XSLT is supported in Firefox, IE6 and Opera 9 appears to be the first Opera to support it. Anyone know if XSLT is supported in Safari and Konqueror? I made some XSLT testing in 2003, but at that time only Firefox and IE6 supported it and Firefox wasn't yet all that popular (Opera being the #2), so I didn't bother to learn much more, although I did a bit of "advanced" stuff with it, such as mixing several XML "database" files to output different kinds of pages.
Re: XSLT? Is this what I want? (Yes it is, help!)
Okay. So the requirement changed. Now, if we want a report, we will be deciding from within the program.
So, I think I"m just gonna do my own XML to HTML in the C# c0d by inserting a handful of class tags during the xml(now html) document creation, and then link up to a css file. That should take care of all I want to do.
I'll have to look at XSLT and XQuery later.
Re: XSLT? Is this what I want? (Meh, forget it.)
For when you come back to this thread, some day:
XQuery is a language that allows you to extract information from a piece of XML. This is not the same as XSLT which lets you manipulate the existing XML information.
A really simple example:
Code:
if (doc("2006.XML")/column[@number="1"]/asset/src/text() eq "ABC") then
for $d in doc("2006.XML")/data/entities
return <sometag>{$d/entityname/text}</sometag>
else
()
This code looks at an XML file (it can also look at any XML output, including web services and XHTML pages), looks at some sort of a condition, based upon that condition it returns either nothing, or a formatted set of tags with some information we may want from that file. They're known as FLWOR statements (pronounced FLOWER). Yeah, gay, isn't it?
Re: XSLT? Is this what I want? (Meh, forget it.)
http://www.vbforums.com/
Merri - XSLT is supported in Safari. Not sure about Konqueror, but I believe it does too.
Bear in mind that unless you need to change the document structure for presentational purposes, you can simply use CSS to style the XML document. Include it the same was as an XSL stylesheet.
Code:
<?xml-stylesheet type="text/css" href="stylesheet.css"?>