Need help with XML/XSL - The WWW & Web Development
vompatti
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 :)
What's programmers favorite thing to do? DELETE CODE!
Git: https://github.com/vhakulinen
oh no you didnt
crshd
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?

-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCA/IT d-(---)@ s+: a-- C+++(++++)$ UBL*+++ P+++>++++ L++ E W+++$ !N !o K !w !O M+>++ !V PS+++ PE !Y PGP+ !t-- !5 !X R@ tv- b+ DI D+ G e h r++ y+
------END GEEK CODE BLOCK------

vompatti
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?
What's programmers favorite thing to do? DELETE CODE!
Git: https://github.com/vhakulinen
oh no you didnt
crshd
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.

-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCA/IT d-(---)@ s+: a-- C+++(++++)$ UBL*+++ P+++>++++ L++ E W+++$ !N !o K !w !O M+>++ !V PS+++ PE !Y PGP+ !t-- !5 !X R@ tv- b+ DI D+ G e h r++ y+
------END GEEK CODE BLOCK------

vompatti
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.
What's programmers favorite thing to do? DELETE CODE!
Git: https://github.com/vhakulinen
oh no you didnt




Members  |  Stats  |  Night Mode