nixers
Need help with XML/XSL - Printable Version
+- nixers (https://nixers.net)
+-- Forum: Development & Graphics (https://nixers.net/forumdisplay.php?fid=7)
+--- Forum: The WWW & Web Development (https://nixers.net/forumdisplay.php?fid=23)
+--- Thread: Need help with XML/XSL (/showthread.php?tid=1201)


Need help with XML/XSL - vompatti - 27-12-2013

Hello there!

I'm been working with this "System Information Manager" program past week and decided to use XML as data format for it, but I can't get XSL to work along... So, I need help with it.

Here is the XML: https://paste.xinu.at/cP8g/

I tried to google the XSL stuff but I just can't get it to work.

Any help is appreciated :)


RE: Need help with XML/XSL - crshd - 27-12-2013

First of all: Why in God's name did you decide to use XML?

Then:
I'd like to see if I can be of help, but I'll need some more info. XSLT? XSL-FO? Got the stylesheet?


RE: Need help with XML/XSL - vompatti - 27-12-2013

I happened to hear that one can get XML easily to web page, that's why I decided to use XML.

And here is the current xsl (xslt?) which I have. (no idea if it's anything what it is supposed to be):
Code:
<xml version="1.0" encoding="ISO-8859-1">
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
    <html>
    <body>
    hi
   </body>
   </html>
</xsl:template>
</xsl:stylesheet>

If I have understood it correctly, that should output just "hi" on plank page.

And I would like to hear your opinion, why shouldn't I use XML?


RE: Need help with XML/XSL - crshd - 27-12-2013

There are a couple of problems I noticed. First of all, you're not including the stylesheet correctly.

Code:
<?xml-stylesheet href="data.xsl" style="text/xsl"?>
should be
Code:
<?xml-stylesheet href="data.xsl" type="text/xsl"?>

then it will get loaded. After that, I had a problem with incorrect formatting of the stylesheet itself. You left out some ?

Code:
<xml version="1.0" encoding="ISO-8859-1">
should be
Code:
<?xml version="1.0" encoding="ISO-8859-1"?>

Then it'll work.


Regarding the usage of XML, it's just a personal thing. I absolutely hate it, because it's a pain to type with all the opening and closing tags. And it's a bitch to parse as well, unless you want to use some pre-build libs, which may have some insane deps. I prefer something "light" like JSON, which does a similar thing without all the tags.

But as I said, it's a matter of personal preference.

Of course, there are some nice things about it. The fact that you can format and display your data in any browser without having to further process it into HTML or something is pretty nice, if that's what you're after.


RE: Need help with XML/XSL - vompatti - 28-12-2013

Sweet, it works now :3 thanks!

And yeah, I usually use JSON too, but my plan was to get this data out to web browser, so I decided to do it with XML instead of parsing JSON with javascript.