- 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
I've actually seen this done in the wild.
It's horrifying.
Admin
Yo dawg, I heard you like XSLTception...
Admin
Just take a look at any fancy-styled modern website and count the number of elements that actually serve to structure the information for display versus those that do not further add any structuring, but are only used to apply visual styling. The latter are almost always in the majority.
XSLT doesn't provide the whole transformation to the "presentation layer", just the transformation from purely logically-structured XML to XHTML, which is usually already different enough. The final step towards the actual site displayed in the browser is still done via CSS.And why exactly is XSLT not suitable for performance reasons? The really neat thing about XSLT is that you can choose to run it client-side on a lot of clients, which offloads the load from your server to your clients. Scales just fine with more clients, since more clients equal more processing power at your disposal. And I assume "complexity reasons" equate to "web guys can't write XSLT" - may be true, and may be a real blocker in practice. But that's why I consider knowledge about XSLT to be an important tool in every web developers' toolbox, which should be just as well-known as CSS.
Because that cost to create the XML is actually negligible, if your internal data structures are good. I think you called it "straightforward" in the quote above. True, I actually haven't used every feature available in XSLT. But the basic stuff definitely works the same on all browsers, and you can come a long way with that. Remember, XSLT is just generating the XHTML, which is then styled using CSS just as usual. Depends on the website. When you look at this site for example, it is also based on a very small set of elements - a navigation, stories, comments, ads, that pretty much sums it up (with each of them possibly having sub-elements of course). There are for sure sites which explode "horizontally" in terms of number of different elements, like portal sites etc., but I would never approach such a site with a client-side XSLT technique. I'm far from proclaiming that XSLT is the right tool for every possible job.But: what the WoW armory definitely had was an extremely sophisticated visual design, way more complex than the average website out there has. That stuff was mostly realized using classic CSS features, of course in combination with XSLT to generate the HTML structures required for the CSS to attach to and do its magic. This way, the hell of divs and divs-inside-more-divs was created just at display time, but didn't have to be transferred to the user on every page request, which resulted in very clean and small pages with extremely impressive visuals.
Admin
Yeah, I did a spit-take on my coffee.
Admin
Admin
Greyhound?
Admin
Wow, the only other actual page I know of using XML + XSL stuff is the Goonswarm's killboard for Eve Online. https://killboard.goonfleet.com/
Admin
Admin
Admin
Actually it is. You implicitly agree to this any time you visit a website. Maybe most sites don't use your processor to render XSLT but they use it one way or another—HTML rendering, JavaScript execution, CSS box model calculations, etc. If you can't spare the processing power it takes to render a page in a browser, you can't afford to be browsing the web. Honestly, processor power on a typical PC is about as close to free as things get.
Admin
I explicitly don't agree.
And it isn't because of the "cost" of CPU time. I'm happy to process data (HTML, CSS) on my machine. You do not get to run your executable code on my machine. It's mine not yours. Get it now?
Admin
The items will stay in the bag just fine, thanks to gravity. Shopping with bags predates shopping with carts by several thousand years. You can use baskets for shopping as well.
Admin
I have had the "pleasure" of ordering from Sketchers before. A week and a half prior to my daughter starting second grade at a new school, she was terrified. All she wanted were her "special shoes" ( the bella ballerina shoes, for those keeping score at home ). Figuring a week and a half is more than enough time to get the shoes in, I made the mistake of ordering them from their website ( sketchers ). 10 business days to ship. No other shipping options.
Once I found that out ( the ording process didn't make that clear until after the bill was paid ), I spent a couple days trying to get a hold of someone, to see if we could expedite that. When I finally did get a hold of someone, they seemed completely uninterested and, frankly, annoyed that I had called. Ultimately, they were unable to do anything for me. So I canceled my order, and ordered from zappos instead. Shoes cost slightly less and were at my door the next day.
What's funny is I canceled my order with sketchers, got a refund and everything. Then, about a week and a half later ( a day after school started, for the record ), I received a second pair of shoes. Given my treatment by the sketcher folks, I didn't feel the need to return them.
Admin
I almost fell for this trolling.
Admin
Yeah. It will be very simple to transform this into HTML 5 now won't it?
I also don't know what you mean by vanilla. Blank xmlns attributes all over the place. span onclick="location.href='/women#Color=Black'" class="swatch swatch-Black">Black</span WTF would you wrap an href in an inline javascript function that turns the href into... an href?
And images that all point to blank images, and have their background image style set to the image they should just be pointing to? That is severe abuse of basic anchor and image tags
Admin
Yes, this site is fairly simple. Simple enough to easily write it as HTML5, which actually has semantic tags for articles, sections, etc. HTML5 is the 2012+ solution to lots of non-semantic tags (plus mobile compatibility, plus new user interface elements, plus local storage, etc.). XML/XSLT is the 2004 "solution" to the same problem.
Admin
::WHISTLE BLOW::
You're missing the point. The "power and your disposal" that you're offloading to clients is work that doesn't need to be performed repeatedly in the first place.
XSLT should not take place at this layer. I've seen it done (and I've even done it myself in the past) and it's a terrible idea.
Admin
SQL Server 2000, natch.
Admin
You do have the right to point your browser somewhere else, or use NoScript. No one cares about your whining.
Admin
I generally find that the degree of structural markup increases as the readability of a webpage decreases, which may suggest it's a design and implementation issue. As for CSS selectors, I see a lot of style sheets that don't use them properly, leading to a lot of duplication in the style sheet and avoidable div or span tags in the (X)HTML.
You haven't seen XSLT used as a full blown templating language for a web presentation layer by the sounds of it. I have several times, and while XSLT offers many of the same facilities as JSP or Velocity it does so in a far more complex and verbose way.
The implementations across browsers vary in completeness and consistency. Regardless of whether it's run client or servers side, the weird recursively functional way that XSLT works and the dependence on a potentially large and memory costly object graph are a hindrance to performance. I also wonder what search engine spiders like Googlebot make of something that serves up spaghetti like the Skechers site.
I was referring to the relatively straightforward conversion to simpler formats such as an RSS feed.
I'm not as familiar with the WoW armoury as you clearly are, but this does sound like a more sensible use of XSLT than most similar ones I've come across. And I guess I should make it clear that while I think XSLT was badly implemented, the idea was sound, and it's certainly less of a nightmare than what preceded it (Google for DSSSL if you're not familiar with it). Personally, I much prefer to do server side processing with a DOM parser, where the XPath sub-language that comes from XSLT is a very elegant feature.
Admin
It's a British expression that describes something which runs more like an asthmatic Dachshund with only two legs than a thoroughbred Greyhound.
Admin
Admin
Not completely correct. In IE9 in dev tools force identification to be of Google Chrome and site will sent XML+XSLT, which is rendered correctly by IE9. However IE will show you already transformed code. They also send WTF to Opera.
Admin
So you're using perceived mistreatment by a party to justify stealing from them. That speaks wonders to your character.
Admin
Fortunately (FSVO), if the User-Agent setting in the HTTP request says that it's IE, the server returns a completely different result.
And the XML/XSL version shows up correctly in Safari and Chrome. (I don't have Opera on any system I currently use.)
Admin
I particularly appreciate how it barfs a bunch of javascript to the page, then immediately replaces it with a big image with a "Play" button in the middle of it.
Admin
Ironically, didn't Zappos just get hacked with 24 million users at risk? (http://gma.yahoo.com/video/money-26594258/zappos-com-hacked-24-million-at-risk-27904921.html). Maybe if they had web developers that could convert xml to spanish to html like sketchers does, this never would have happened.
shakes head
Queue the "My son converted xml to spanish once and I can assure you, it's no laughing matter" comments...
Admin
...what?
6000 lines is nothing on modern hardware. Heck, the Delphi compiler can chew through that in literally a fraction of a second. Any parser worth the name, for pretty much any language won't even blink at 6KLOC. (Assuming, of course, that you're not using a broken language such as C++ where parsing itself can be a Turing-complete task and so can take an arbitrary amount of time even on small inputs.)
Admin
Ah, but with zero-based indices, comment 0 is still the first comment, and comment 6 is the seventh. Get back to school, tighter.
Admin
PIPA Request: You have posted copyrighted code that (may) belong to someone else. Your DNS records are being removed as well as the DNS records of all sites you link to
Admin
Admin
By "Doesn't work in IE" you mean "dosen't work in IE8 and below" (IE8 is probably as I didn't test it)
Admin
[quote user="Ralph"][quote user="java.lang.Chris;" a typical XSL processor is a very resource hungry beast and anything they can offload to the client is a win.[/quote] 'scuse me, my processor is not yours to appropriate, kthxbai[/quote] If you're consuming my data, than it certainly is. Would you rather I send you a gif so your processor doesn't have to process the html dom as well?
Admin
Admin
[quote user="Paul Neumann"][quote user="Ralph"][quote user="java.lang.Chris;" a typical XSL processor is a very resource hungry beast and anything they can offload to the client is a win.[/quote] 'scuse me, my processor is not yours to appropriate, kthxbai[/quote] If you're consuming my data, than it certainly is. Would you rather I send you a gif so your processor doesn't have to process the html dom as well?[/quote]
This is the dumbest rebuttal ever. A gif cannot represent structure, events, or anything that HTML does. There are clear benefits to serving HTML instead of an image of a website to the receiver. There is absolutely no benefit in serving XSLT instead of HTML to the receiver.
Would you rather me send you a binary gif through an img tag directly, or embed an encoded string representation of a gif and have your browser do all of the work?
Admin
Actually, last I checked, IE and Firefox supported it -- and Chrome appears to -- but other random browsers, like Konqueror, did not.
Also, I do actually see a point here. If HTML doesn't provide enough of a semantic context for the HTML itself to be the API, then you need an XML or JSON API anyway -- though of course, there seem to be a lot of people these days who think HTML does provide enough semantics, and they have a point. But if your API is going to be non-HTML, and it's going to provide all the same information -- especially if it's going to provide it in a more bandwidth-efficient way -- then having the client do the work of actually applying a template makes sense.
Having the server do the transformation for browsers which don't support doing it themselves also makes sense -- XSLT has plenty of libraries anyway, and this way you get the best of both worlds. It's like having the server support gzipping the page or not.
Other sites that do this kind of thing without ending up on thedailywtf. Twitter servers most of its content in JSON these days -- twitter.com/thedailywtf becomes twitter.com/#!/thedailywtf, so the JavaScript on 'twitter.com' interprets any hashtag URL, uses Twitter's own JSON API, and manages any HTML templates itself.
So why is reinventing the wheel with JavaScript, of all things, not WTF-worthy, but using the browser's native XSLT support is automatically a WTF? Is it because anything XML translates as WTF?
I'm not defending the sketchers site -- it does, in fact, look sketchy, and not at all like a site that's taking advantage of this (they use JavaScript to generate XSLT themselves) -- but I don't see this as a WTF in its own right. Not how I'd do things (HTML is probably rich enough), but not automatically a WTF.
Admin
Bonus points for leaving ViewState enabled on that label.
Admin
Point, set, match.
The "structure, events, or anything that HTML does" is exactly the processing I was referring to. The actual troll comes in at the amount of processing required to display the gif. There is no such thing as a free lunch.
Wrap it up in base64 and inline it with the css so I don't have to make multiple requests to the server, please.
CAPTCHA: conventio -- The commings and goings of monks.
Admin
I don't get this. This seems to be a very legitimate and neat way of doing things. Band-width saving spitting out of XML, save server cpu by distributing rendering over all clients, it loads fast?
Really, in many years this is the first article where I have to say nothing to see here.
Admin
Captcha: wisi (not always wig)
Admin
Another example: Anyone who describes a good night's sleep as "sleeping like a baby" never had one.
Admin
So, literally, nothing to see here. Or at least nothing I'd want to see. Just some script barf all over the page.
Admin
This style of code (right down to the dynamically generated javascript) was the standard for about 10 years at the Fortune 500 company I work at. I spent the better part of a year maintaining a mess very similar to the Skechers site and It's all exactly as horrifying as it seems.
Our company has thankfully killed this standard and is busy writing the replacement. What horrifies me about Skechers is that it's fairly new and not 5 years old.
Admin
This argument is sillier than you've made it out to be, but you're still missing the point. I buy that this solution isn't terrible if it was cheap and the datasource is decently formatted XML from some other Enterprisey system. What I don't buy is what you seem to be trying to push -- this is the way it SHOULD be done, because it saves YOU money.
2 step processing still requires 2 steps of processing. You're using the fact that "the client has to do the processing, not my server!" as some magical scalability and performance feature. It's not. The fact that you can offload work to a client doesn't make it proper.
XSTL has it's place, and the outter most presentation layer is not it.
Multiple requests? There's a single request for the gif once, unless you choose to not set proper caching headers. In the latter case, please don't make any other arguments about "saving bandwidth" or "offloading work to clients". Embedded content is processed every single time, in this case even if the HTML is cached. The external gif is loaded once.
Also, it's 2012. Congrats, you saved 12ms by embedding the image instead of just using an [image] tag. And what zero-time tool did you use to encode the image?
Admin
We already have better tools for doing all of this.
You get major benefits, which include:
This entire story is one gigantic WTF. Also, CAPTCHA: haero. The developers of this system are my haeros.
Admin
Bags not allowed to take inside store. Leave bag with security, get token and go to store. Shopping cart allowed inside store.
Admin
Admin
Previous version of armory did.
Admin
Admin
Umm, where is it that you have knowledge of how their data is being sourced? Also, yes! Saving money is exactly why we all have jobs. Anything done by a computer can equally well be done by man, given a sufficient pool of workers. Computers make it cheaper!
Yes, pipelining the data generated elsewhere to the client to have it processed according to the number of requests received is "some magical scalability and performance feature."
Perhaps you are new to the interwebs? Here is a guide you should find most useful: http://go at. cx