|
-
Jul 24th, 2006, 02:24 PM
#1
Thread Starter
Fanatic Member
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.
Last edited by JPicasso; Jul 26th, 2006 at 07:46 AM.
Reason: title change
Merry Christmas
-
Jul 24th, 2006, 04:28 PM
#2
Re: XSLT? Is this what I want?
Anything that can be done with HTML/CSS and even Javascript can be output using XSLT.
-
Jul 25th, 2006, 02:39 AM
#3
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.
-
Jul 25th, 2006, 07:34 AM
#4
Thread Starter
Fanatic Member
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?
-
Jul 25th, 2006, 07:53 AM
#5
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>
-
Jul 25th, 2006, 12:08 PM
#6
Thread Starter
Fanatic Member
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...
-
Jul 25th, 2006, 03:28 PM
#7
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.
-
Jul 25th, 2006, 04:21 PM
#8
Re: XSLT? Is this what I want? (Yes it is, help!)
 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
-
Jul 26th, 2006, 03:31 AM
#9
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.
-
Jul 26th, 2006, 07:45 AM
#10
Thread Starter
Fanatic Member
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.
-
Jul 26th, 2006, 08:13 AM
#11
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?
-
Jul 26th, 2006, 09:56 AM
#12
Re: XSLT? Is this what I want? (Meh, forget it.)

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"?>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|