Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Feb 2003
    Location
    Finland
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Problems making "real" XSL stylesheet and some more

    In my site, i use news system based on SSI, Perl and flat-file databases, also called Content Management System. Anyways, last night i modified all news files to valid xml, every news article is it's own xml file, like this:

    ---------------------------
    <?xml version="1.0" encoding="iso-8859-1"?>
    <header>
    <topic>Internet Explorer sucks</topic>
    <author>Mikko</author>
    <date>12.3.2003 08:25</date>
    <related>3</related>
    <icon>xml-ico.gif</icon>
    <data>
    News issue dated 12.3 blah blah blah..
    </data>
    </header>
    ---------------------------

    These xml files are then parsed with Perl, and placed within XHTML 1.1 page, as presented via CSS. They dont have XSL stylesheet, because it was just way too difficult coding one I did try like this:

    ---------------------------
    <?xml-stylesheet type="text/xsl" href="xml-topic.xsl"?>
    ---------------------------

    and in the XSL file, using CSS rules like:

    ---------------------------
    <div style="font-size: 12px;color: #666666;">
    ---------------------------

    but only Internet Explorer (6.0) bothered to show my custom styles, Mozilla did nothing as like the much praised Opera 7.

    Aaa-nyways, the real problem is that i cannot place HTML elements like A, UL, LI, P or whatever inside the "data" element on the xml file, 'cause the Perl parser goes nuts.

    As a solution i coded all HTML elements inside the news files, to look like this, [BR], [A HREF], [P] and so on. Then when visitor requests some topic, those coded elements are decoded back to normal elements.

    It's just pretty slow and memory hogging way, makes the server scream more processor cycles, everytime it parses the scripts.

    So any suggestions of making my system more "efficient"? I'm out of ideas.
    Last edited by mellin; 03-12-2003 at 05:46 PM.

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You have your answer right there - XSL is the answer. Don't give up too easily

    Your Netscape 7 problem is probably down to your xsl-stylesheet reference - there's actually no such mime-type as "text/xsl" so if you change it to "text/xml" it should work ...

    Opera 7 doesn't support client-side XSLT, which is a shame.

    But you can do it server-side, so you deliver parsed XHTML directly to the client. What kind of server are you running?
    Last edited by brothercake; 03-12-2003 at 08:16 PM.
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark

  • #3
    New Coder
    Join Date
    Feb 2003
    Location
    Finland
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The server where my site is located, is Cobalt Cube running Apache.

    I didn't know that Opera 7 would not support client-side XSL, shame really when being so good browser in other ways. Then what browsers do support it fully, Mozilla 1.2.1, how about IE 6.0?

    So what, headers are wrong? Have to try that, may be an answer.

    Yesterday i borrowed two thick XML concentrated books from local library, over 800 pages of stuff. Have to check them out as well.

  • #4
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    client-side XML is supported in mozilla and ie6; ie5 has support, but it's implementation is broken (based on a pre-1.0 XML specification, to be fair)

    IMO server-side transformation is the way to go for production use; client-side XML to be saved for the future ... and applications for predictable environments .. or if you just don't care about the restricted browser support.

    There are numerous ways of doing XSLT on the server. Most of them are based on Xerces or Xalan (XSLT engines which are available variously in Java, Perl, COM, C++, probably others).

    They generally use APIs or language extensions to work with - I personally recommend a language extension, since they give you a process opportunity before and after parsing the data (and because the Apache XSL-API I know of uses file-names as pointer variables, which can be restrictive)

    If you're hosted, ask your host. If you run your own server, then you'll have to get down and dirty - http://xml.apache.org/ is a good place to start
    Last edited by brothercake; 03-18-2003 at 07:13 PM.
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •