*.xsl

Some of us love those electrons just a little too much
Post Reply
User avatar
Taxious
Rum Guzzler
Posts: 5056
Joined: Fri Apr 18, 2003 10:16 am
Location: Denver, CO

*.xsl

Post by Taxious »

Alright srsla, why would anyone want to use this shitty unintuitive "language"? Is it another lack of experience thing on my part or does writing out *.xsl files just fat suck?
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Ddrak
Save a Koala, deport an Australian
Posts: 17516
Joined: Thu Jan 02, 2003 3:00 pm
Location: Straya mate!
Contact:

Re: *.xsl

Post by Ddrak »

It's what happens when you let a committee design a language. Especially a committee who thinks making everything XML is a really cool idea.

Dd
Image
User avatar
Taxious
Rum Guzzler
Posts: 5056
Joined: Fri Apr 18, 2003 10:16 am
Location: Denver, CO

Re: *.xsl

Post by Taxious »

It just seems like they made things a lot more difficult than they need to be. WTF is with the screwy syntax anyway? And I hate having to replace some "<" with "<" as well as other characters. Worst shit ever!
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Freecare Spiritwise
Grand Pontificator
Posts: 3015
Joined: Thu Mar 13, 2003 5:35 pm

Re: *.xsl

Post by Freecare Spiritwise »

Taxious wrote:It just seems like they made things a lot more difficult than they need to be. WTF is with the screwy syntax anyway? And I hate having to replace some "<" with "<" as well as other characters. Worst shit ever!
That's just XML (or SGML?) and nothing to do with XSL. If XML let you put characters like less than/greater than as literal text, how would distinguish that text from tags?

<hello>
<some_text
</hello>

See? Would look like an open tag to any parser, where:

<hello>
<some_text
</hello>

is fine. It has nothing to do with XSL being teh suck.
User avatar
Taxious
Rum Guzzler
Posts: 5056
Joined: Fri Apr 18, 2003 10:16 am
Location: Denver, CO

Re: *.xsl

Post by Taxious »

Yeah of course FreeC, but what I'm referring to has nothing to do with the xml content. Sometimes the actual XSL side of things doesn't work unless you convert characters in the code to "<" or ">".

For example, to make an image in xsl it seems like I should be able to do this:

Code: Select all

<img src='<xsl:value-of select="$imageLink" />'  />
but I end up having to write the xsl like this, otherwise it wont render:

Code: Select all

<img src='<xsl:value-of select="$imageLink" />'  />
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Freecare Spiritwise
Grand Pontificator
Posts: 3015
Joined: Thu Mar 13, 2003 5:35 pm

Re: *.xsl

Post by Freecare Spiritwise »

/sigh how would a parser tell the difference between XML tags and HTML tags as inner text inside an XML tag? It couldn't, because they are both SGML...

It has to be that way because you're putting HTML snippets as literal content inside of your XML file.

I don't have a problem with any of the __ML languages until you try to put content of one inside the other and not get confused. One of the reasons I despise XSL.

EDIT: And to specifically address your example, if you didn't frame it with &lt and &gt then it would be an XML tag and not an HTML tag inside of an XML tag like it should be. Again, inner XML text as HTML FTL!
User avatar
Taxious
Rum Guzzler
Posts: 5056
Joined: Fri Apr 18, 2003 10:16 am
Location: Denver, CO

Re: *.xsl

Post by Taxious »

Freecare Spiritwise wrote:/sigh how would a parser tell the difference between XML tags and HTML tags as inner text inside an XML tag?
Every xsl statement starts with "<xsl:" so it doesn't seem like it would be that hard for a parser to figure out the difference between xsl and html...
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Freecare Spiritwise
Grand Pontificator
Posts: 3015
Joined: Thu Mar 13, 2003 5:35 pm

Re: *.xsl

Post by Freecare Spiritwise »

XSL is built upon XML, and if you allow literal HTML content inside of an XML file, then it's not XML. You're preaching to the choir as far as XSL being the suck, but methinks you're not understanding XML.
User avatar
Taxious
Rum Guzzler
Posts: 5056
Joined: Fri Apr 18, 2003 10:16 am
Location: Denver, CO

Re: *.xsl

Post by Taxious »

Yeah sorry, I'm not trying to argue but more understand what you are getting at. I need to go back and read some of the basics I guess, but from what I understand XML is just a way to label things with tags.

Code: Select all

<tags> things </tags>
So can't html just be considered as another form of XML?

Code: Select all

<html><body> some things here </body></html>
Then XSL can take the XML nodes and transform it into whatever else through the "<xsl:" tags

Code: Select all

<xsl:value-of select="//tags[@Value]" />
I'm still not seeing why a parser wouldn't be able to pick a <xsl: tag out of another tag. I'll go read some more about it I guess.
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Freecare Spiritwise
Grand Pontificator
Posts: 3015
Joined: Thu Mar 13, 2003 5:35 pm

Re: *.xsl

Post by Freecare Spiritwise »

XML and HTML are both subsets of SGML.

So putting things in <tags></tags> is really SGML. So because both XML and HTML both put things in tags (because they share the same mommy), if you put HTML content inside of an XML file then you can't tell whether it's an XML tag or HTML tag without changing the language. Because for example <a href="www.microsoft.com" /> are both valid XML *and* HMTL tags.

Sure, you could write an __ML parser that could tell the difference for your example, but it wouldn't be compliant with the language.

The real issue here is that XSL is a retarded language for trying to put literal content of one SGML language inside of another SGML language.
User avatar
Taxious
Rum Guzzler
Posts: 5056
Joined: Fri Apr 18, 2003 10:16 am
Location: Denver, CO

Re: *.xsl

Post by Taxious »

Alright, I know php and xsl are very different but stay with me here.

1) If I have some html/php code like:

Code: Select all

<a href='<?php print $someURL; ?>'> click here </a>
The php parser will run through and recognize the <?php tag and swap in whatever value "$someURL" has.

2) If I have some html/xsl code like:

Code: Select all

This is a URL: <xsl:value-of select="$someURL" />
The xsl parser will run through and recognize the <xsl: tag and swap in whatever value "$someURL" has.

3) Why then, can't the xsl parser pick out the <xsl: tag out of a statement like this?

Code: Select all

<a href='<xsl:value-of select="$someURL" />'> click here </a>
You say it wont work because the xml/html tags are ambiguous, yet as seen in example 2, the xsl parser will do whatever it's told to do when it sees a <xsl: tag.

I feel retarded for basically asking the same question again after you've explained things - but something still isn't clicking for me.
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Freecare Spiritwise
Grand Pontificator
Posts: 3015
Joined: Thu Mar 13, 2003 5:35 pm

Re: *.xsl

Post by Freecare Spiritwise »

Yeah dude, I dunno why it's not clicking /shrug different people get hungup on different things. Maybe DD or someone else here can explain it better, but the best I can come up with is that you're mixing two different languages that are both derived from the same language and you'll be fighting that ambiguity every step of the way. The language is what it is. Maybe it doesn't look ambiguous to your eyeballs, but that doesn't mean the parser can parse it using the rules of the language.

I've never been a specs nazi kind of guy so I can only say what works for me, and that's to work with something hands-on until I understand it and it clicks. Einstein always said something about learning by example and that's what's worked best for me, so all I can say is work with it and make it your bitch. But personally to me, I fucking hate languages like XSL and I'd rather spend my time working with something useful, but hey, you don't always get to choose.

So I guess what I'm saying is not to force it. Just keep at it and it will click, unless you're a retard, which you're not.
User avatar
Taxious
Rum Guzzler
Posts: 5056
Joined: Fri Apr 18, 2003 10:16 am
Location: Denver, CO

Re: *.xsl

Post by Taxious »

Freecare Spiritwise wrote:I fucking hate languages like XSL and I'd rather spend my time working with something useful, but hey, you don't always get to choose.
Ain't that the truth. I've been plugging through stuff with what I know works, but it drives me crazy to not understand why I have to do something that's fucking retarded/unintuitive (IMO) like replacing "<" with "lt;" Hopefully I'll get one of those big "ahhh ok" moments soon though.

As much as I hate xsl, I have to admit that it's pretty funny to show it to one of our design guys when they want to just make a simple markup change. It's always the "wtf is this shit" look that I had when I first saw it.
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Ddrak
Save a Koala, deport an Australian
Posts: 17516
Joined: Thu Jan 02, 2003 3:00 pm
Location: Straya mate!
Contact:

Re: *.xsl

Post by Ddrak »

It's because "<xsl:" isn't a tag.

xsl: is a namespace for the element following. You can actually redefine it to anything you like at the top of the xml file, just "xsl" is the convention for "http://www.w3.org/1999/XSL/Transform". If you want to cut down on typing you can just make it "x" or "xs" or whatever you like.

Dd
Image
User avatar
Taxious
Rum Guzzler
Posts: 5056
Joined: Fri Apr 18, 2003 10:16 am
Location: Denver, CO

Re: *.xsl

Post by Taxious »

Well - the namespace is really just a label for the XSL parser to pick up on, right? If I renamed it to <ddrak: I'd still have the same question as to why I can't put XSL statements inside of HTML tags.
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Ddrak
Save a Koala, deport an Australian
Posts: 17516
Joined: Thu Jan 02, 2003 3:00 pm
Location: Straya mate!
Contact:

Re: *.xsl

Post by Ddrak »

The point is (as FC mentioned) that an XSL document *must* be valid XML. That's the definition of XSL. While you could write a parser to do what you say, you're shooting yourself in the foot by messing up the clean layered design of:

1. Parse XML into a DOM
2. Extract XSL from DOM
3. Perform transform.

Instead, you're saying that you don't want to use the standard XML parsers and seriously increasing the difficulty in both writing and maintaining parsers. Yes, you *could* do what you're saying but why would you?

Incidentally, the < trick really isn't the right way of doing it. You should be using <xsl:attribute> tags.
Image
User avatar
Taxious
Rum Guzzler
Posts: 5056
Joined: Fri Apr 18, 2003 10:16 am
Location: Denver, CO

Re: *.xsl

Post by Taxious »

Ddrak wrote:The point is (as FC mentioned) that an XSL document *must* be valid XML.
Ah I think I missed that somewhere. I was more under the impression that XSL was its own type of deal, nothing to do with XML other than it uses "<" and ">" tags. (like php for example) I guess that makes sense with not being able to have XML tags inside of other XML tags.

Thanks for all the clarification guys.
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Post Reply