- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Bonus points for style?
:-D
Admin
Nice arrows you got there...
Admin
wtf!
...but, if you scroll it down fast enough, it's kinda nice-looking. Maybe he is a better ascii-art-composer then a programmer.....
Admin
Definitely worthy of "WTF"! I hope for the developer's sake he made a custom tool to edit this crap out so he doesn't have to do it by hand!
Admin
Yes, this is exactly why I think that for anything besides browser display, XSLT is the devil.
Admin
When I see ucirc I alwasy think û so this makes perfect sense.
Admin
This is lovely!
It actually reminds me of an old Apple ][ game where you had to use the left and right arrows to maneuver a cursor between scrolling text “walls”. (Kinda simulating falling down a hole.)
Come to think of it, I believe it was the result of a “single line program” contest. The whole program was entered in on a single Apple Basic line. One line was limited to either 128 or 256 characters, don’t remember which.
It was pretty impressive for its compactness. I would not have wanted to try to maintain THAT either, but at least it did something reasonable.
Admin
You know, I'm not a total newbie to XSL, but for the life of me I can't imagine why anyone would want to do this. I strongly suspect six days of work could be boiled down to this:
<FONT color=#0000ff size=2><</FONT><FONT color=#800000 size=2>xsl:value-of</FONT><FONT color=#ff00ff size=2> </FONT><FONT color=#ff0000 size=2>disable-output-escaping</FONT><FONT color=#0000ff size=2>="yes"</FONT><FONT color=#ff00ff size=2> </FONT><FONT color=#ff0000 size=2>select</FONT><FONT color=#0000ff size=2>="$input"/>
</FONT>But without knowing the original requirements, that's just a shot in the dark.
Admin
The real WTF is that he did not include replacements for all unicode characters.
That code would not parse ????? (wa-te-fa-ku) correctly to ワテファク.
Admin
You should check the international C objuscation contest, they make better things in less lines and more unmaintanable.
Admin
It is making me seasick. [+o(]
Admin
six days, ha that guy was way underpaid
I bet i could have made it last at least two weeks, taken a day off and came back with a longer list. Oh an I would have used C#.NET to make a program that would do it all for me, allowing me to surf the web and buy "it" from ebay.
Admin
There is always someone out there who takes a good idea/good tool and then abuses it to the point of stupidity while thinking they are being clever.
Annoying, but hardly a wtf. Stupidity neither confuses, nor surprises me when I see it (even outa myself on the occasion).
Admin
Indeed. Some... no, most uses of XML are truly repulsive. XML-RPC and SOAP, for example. (Worse than Tubgirl.) And XSL in general is high on the list. I can only hope, for the good of the Web, that XSL-FO (a new part of the XSL suite -- like CSS, except in XML) is not widely adopted. Seriously, what the hell is W3C thinking these days?
My theory is that people think that any technology with an acronym starting with an 'X' is cool by default. Since the letter X is completely useless anyway, I propose we eliminate it from the alphabet. That'll put the various data-ekschange formats on an equal playing field.
Admin
Cute, but that would leave him with invalid HTML, because the wëïrd characters would get copied into the output without being transformed to wëïrd. The fun thing is that XSL doesn't provide for this so everybody has to create their own solution; like having &euml; in the input and then doing the 'disable-output-escaping="yes"' thingy.
P.S. XML > S-expr
Admin
IsTrue(Idiot!) = True
Admin
This thing... Hurts my eyes...
Admin
why?
it looks good [:P] (if you scroll fast enough)
Admin
Moin,
Somebody should have told him about the concept of character encodings. There is absolutely no reason to escape anything other than & and < (and maybe > and ") in HTML. Simply select the right character encoding and everything will be fine. (This especially goes to Joost_: Of course "wëïrd" would not be invalid in HTML, so long as you declare what encoding you're using.)
--
Henryk Plötz
Grüße aus Berlin
Admin
SIX STRAIGHT DAYS to cut and paste all that? Eesh.
Admin
The dog ate my homework^W^W^W^W'forum' software ate my characters: What I said was of course:
There is absolutely _no_reason to escape anything other than & and < (and maybe > and ") in HTML.
Admin
At least it's nicely tabbed...
Admin
If you zoom out really far, you can see a dot and two right angle brackets.
[image]
Admin
I'm not intending to be a whipzor (don't ask, I mean pointdexter) but the output would be UTF-8, so Unicode would be OK, see there's a difference between escaping for ambigiouty and escaping for readability/transport stuffies.
Admin
He should be assigned to extend this code to cover the whole unicode range :) That would be a real opportunity to show all those great XSL skills :D
Admin
So much stupid work, and it doesn't even contain the right translations for German umlauts.
äöü ÄÖÜ ß
auml ouml uuml Auml Ouml Uuml szlig
Admin
He just copied the idea from the great pyramids of Div!
Admin
Did anyone else thing they were playing spyhunter when they scrolled down?
Admin
Admin
Reminds me of those old spams I used to get that said to hold the scroll down button, then a shit-ton of lines flew up, and "animated" characters cris crossed.....
Admin
Anyone know why " " needs to be changed to " "? Wasn't it valid html to start with? (Yeah, I read through it. I'll go be embarrassed now.)
Admin
oh my god you stupid ass wipe.
I'll say this--the code is very pretty to watch when you scroll up and down.
Admin
And on the seventh day, he rested. Unfortunately, he did not quit programming.
Sincerely,
Gene Wirchenko
Admin
Cue the crash music.
Sincerely,
Gene Wirchenko
Admin
[image]
My god, XSL code shaped like giant angle-brackets? You know you're in the presence of a true artist when form and function are combined so flawlessly.
Have you read Code Reading: An Open Source Perspective, by the way? Not many people out there that 'zoom out' of code...
Admin
Could this not be solved by simply specifying the encoding in the XML document?
Simple as that, right? Just seems like he did lots and lots of work for absolutely no reason. I am a bit fond of XML myself, but this is just ludicrous.
Admin
Sigh
XML is designed to allow entities to be defined in the DTD. There's no need for a single line of that code.
But in general... why bother anyway? Numeric entities are much more convenient. What's the point in defining a bunch of entities when you only end up using most of them once or twice anyway.
But never mind.... I think it's fun that he's made the the thing look like a couple of angle-brackets.... sort of like fractal code -- it looks the same from a long way away as it does close up ;)
Admin
Replacing with the U+0020 character (space) would be incorrect - the right character would be U+00A0 (no-break space). In the code that Alex posted the U+0020 character is used, but that could be a copy-paste error, so now we'll never know whether the original code had a bug or not.
(This WTF'ed forum ate my first post. Can't you just fix/change it?)
Admin
Powers of Ten, anyone? I bet at 10^26 this becomes the entire XMLiverse
http://en.wikipedia.org/wiki/Powers_of_Ten
Admin
Please, please, would someone drag out this "programmer" and break his fingers. All of them. Or better yet, just shot him. He just needs killing.
Admin
I remember that game! I would play it when I got tired of Lemonade Stand!
Admin
Ever heard this?
XML is like violence: if it doesn't work, use more.
Admin
Is nobody taught anymore that this crap takes real time to process!? And unless I'm completly out of my mind, you want your web servers to be able to handle more that 4 users, right?
------
Don't kill him, but make friday beat the idiot day.
DD
Admin
Forum software is hard!
Admin
"Night Driver" implemented completely in XML! Brilliant!
Admin
Sorry Mr. Plötz, I was under the impression that IE was just being too forgiving when putting weird characters in HTML documents.
Admin
<font size="3">XSLT is a difficult dialect to fully master. Leaving aside for the moment the core issue of replacing textual content inside an XSLT document (which requires recursion), the following is an example of a cleaner implementation:
POC.xml</font>
<font size="2"><?xml version="1.0" encoding="iso-8859-1" standalone="yes"?>
<?xml-stylesheet href="poc.xsl" type="text/xsl"?>
<content>
Hello this is the letter <b>ê</b>
</content>
<font size="3">
POC.xsl</font>
<?xml version="1.0" encoding="iso-8859-1" standalone="yes"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
exclude-result-prefixes="msxsl">
<xsl:output encoding="iso-8859-1" method="html"/>
<xsl:variable name="items">
<item text="ê" html="&egrave;" />
<item text="à" html="&agrave;" />
<item text="á" html="&acute;" />
<!-- add more items to be replaced -->
</xsl:variable>
<xsl:variable name="count" select="count(msxsl:node-set($items)/item)" />
<xsl:template match="@* | ">
<xsl:copy><xsl:apply-templates select="@ | node() "/></xsl:copy>
</xsl:template>
<xsl:template match="text()">
<xsl:call-template name="replace">
<xsl:with-param name="content" select="string(.)" />
</xsl:call-template>
</xsl:template>
<xsl:template name="replace">
<xsl:param name="content" />
<xsl:param name="counter" select="number(1)"/>
<xsl:variable name="node" select="msxsl:node-set($items)/item[$counter]" />
<xsl:choose>
<xsl:when test="contains($content,$node/@text)">
<xsl:call-template name="replace">
<xsl:with-param name="content"
select="concat(substring-before($content,$node/@text),$node/@html,substring-after($content,$node/@text))" />
<xsl:with-param name="counter" select="$counter" />
</xsl:call-template>
</xsl:when>
<xsl:when test="$counter < $count">
<xsl:call-template name="replace">
<xsl:with-param name="content" select="$content" />
<xsl:with-param name="counter" select="$counter + 1" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise><xsl:value-of select="$content" disable-output-escaping="yes"/></xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet> </font>
Admin
If it took six days to craft the XSLT, then either the developer does not understand XSLT, or the document design is suspect or even worse, there is a misapplication of XSLT to solve a certain problem domain.
In this WTF, it obviously is the last.
For one, textual recursions inside XSLT incur a heavy performance penalty. If this was for a Microsoft platform and static HTML files are generated, I'd use a custom class with an XmlReader to do the textial replacements instead of resorting to XSLT which is a dirty way to get it done (and incidentally is not quick when the size of the document goes beyond a certain magic number)
XSLT is very handy to handle UI issues and apply presentation logic, especially in AJAX applications. But it should not be used throughout an application domain just because it seems cheap and easy to use.
Admin
What, you've never seen this kind of code before??
Am I the only one working with such morons on a regular basis? o.O
Admin
Anyone who's ever used XSLT to transform XML to get decent HTML layouts knows that XSLT is a WTF all on its own.
For anything other than simple outputs it's one of the shittiest ways to manipulate XML. For anything requiring comlpex layouts you're much better off using a standard C++ or Java DOM parser.