Results 1 to 12 of 12

Thread: XSLT? Is this what I want? (Meh, forget it.)

  1. #1

    Thread Starter
    Fanatic Member JPicasso's Avatar
    Join Date
    Aug 2001
    Location
    Kalamazoo, MI
    Posts
    843

    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

  2. #2
    Frenzied Member DeadEyes's Avatar
    Join Date
    Jul 2002
    Posts
    1,196

    Re: XSLT? Is this what I want?

    Anything that can be done with HTML/CSS and even Javascript can be output using XSLT.

  3. #3
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    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.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  4. #4

    Thread Starter
    Fanatic Member JPicasso's Avatar
    Join Date
    Aug 2001
    Location
    Kalamazoo, MI
    Posts
    843

    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?
    Merry Christmas

  5. #5
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    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>
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  6. #6

    Thread Starter
    Fanatic Member JPicasso's Avatar
    Join Date
    Aug 2001
    Location
    Kalamazoo, MI
    Posts
    843

    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...
    Merry Christmas

  7. #7
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    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.

  8. #8
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    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
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  9. #9
    VB6, XHTML & CSS hobbyist Merri's Avatar
    Join Date
    Oct 2002
    Location
    Finland
    Posts
    6,654

    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.

  10. #10

    Thread Starter
    Fanatic Member JPicasso's Avatar
    Join Date
    Aug 2001
    Location
    Kalamazoo, MI
    Posts
    843

    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.
    Merry Christmas

  11. #11
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    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?

  12. #12
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    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
  •  



Click Here to Expand Forum to Full Width