Re: Xpath
"Jenda Krynicky" <[email protected]> Fri, 14 Dec 2012 22:31:21 +0100
| Newsgroups | gmane.comp.lang.perl.xml |
|---|---|
| Message-ID | <[email protected]> |
From: Tim Brody <[email protected]> > To use an analogy, XSLT is to XML what regexps are to text. Yes, it > takes some time to get your head around but once you do it makes XML > transformations quick to achieve. XSLT is flexible enough to be used > procedurally or as pattern matching - "foreach" vs. "template". If you said XPath is to XML what regexps are to text, I would agree. To some extend. > XML::LibXSLT also supports callbacks into Perl space, so you can mix and > match XSLT and Perl in the same template. > > To work effectively with XML you should familiarise yourself with DOM, > SAX and XSLT, then you can apply the best technology to the problem in > hand. Otherwise, you can always use one of the modules that turns XML > into native Perl structures ... What was the word ... codswallop? If you have to work with XML in many different languages, some of which happen to be as restricted and as restrictive as, say, Java, your best bet is to learn those overcomplicated, overdesigned, overtalkative and next-to-imposible to read technologies. If on the other hand you need to work with XML efficiently, but don't care that much about a false sense of knowledge portability, you'd better forget about them. DOM kinda makes sense considering the requirement was to use the lowest common denominator of programming languages. SAX is at the same time too low level and overcomplicated. XSLT is just a joke that borders in readability with Brainfuck. Really, xml in xml in xml in xml? Processing instructions, tags you want in the output all mixed up, all indistinguishable, all messed up. It's like designing a templating system and selecting the most common character as the special character. Imagine HTML designed with the letter e used as tag start and t as tag end, a as the start of entity and i as it's end. The only, very dubious benefit is that the implementors do not have to write a parser, because the user of this template system had been forced to write the "code" in a simple syntax tree serialization. And before someone starts to babble about the need to stop thinking proceduraly, because XSLT is functional ... I've worked with functional languages. With lazy, purely functional languages to be exact. The problem doesn't lie in XSLTs purported functionality. It lies in its braindead syntax. Jenda ===== [email protected] === http://Jenda.Krynicky.cz ===== When it comes to wine, women and song, wizards are allowed to get drunk and croon as much as they like. -- Terry Pratchett in Sourcery _______________________________________________ Perl-XML mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs