Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: What's Your Mental Image of XSLT?

by BrowserUk (Patriarch)
on Oct 11, 2003 at 01:02 UTC ( [id://298458]=note: print w/replies, xml ) Need Help??


in reply to What's Your Mental Image of XSLT?

My first thought

For a mental image of XSLT, the first thing that sprang to mind when reading your post was the council chamber at the European Union, or the debating halls at United Nations.

If you've ever seen news footage of those places when a well supported debate is in full flow and seen the army of translators running around whispering on-the-fly translations into the ears of the delegates, observed the confusion on those delegates faces as they get miss-predicted or misinterpreted native language translation of the current speakers words, followed (hopefully) by the dawning of realisation as the translations are corrected in real-time. Seen their initial reactions of confusion or disgust turn to realisations of understanding and joy -- or vice versa -- then you may understand my mental picture.

I've seen various attempts at defining a common language for computer systems intercommunication that have been forthcoming over the years. Unfortunately, like Esperanto, nobody ever quite talks them the same way. Each native (proprietary!) speaker has the habit of imposing their own native dialect upon the basic structure and semantics of the language. Each tries to use and extend the use of the "common language" to incorporate and reflect the semantic variety, expressiveness and beauty of their own native language. The result is that they end up speaking as many dialects of the common language as there are native languages -- and often more, as each individual 'native-X' speaker tends to enhance their vocabulary in different ways.

A second view

For a second mental image, I go back to an unscheduled stop-over I made in New Delhi, India a few years ago. I was on a flight from Hong Kong back to the UK that was meant to touch down at New Delhi, re-fuel, exchange a few passengers and fly on. Four of the 16 main tyres on the jumbo jet burst upon landing and they didn't have replacements to hand, so we ended up being forced to spend the night and the following day in local hotels whilst replacements where flown in.

In most ways, this was a delightful and pleasurable experience as the hotels were superb, the cuisine excellent and the local people as interesting and friendly as they were diverse. There was one fly-in-the ointment. None of we transit passengers had the requisite visas for entry to the sub-continent, and so, for security reasons, our passports were taken from us at the airport prior to being bussed to our hotels. Theoretically, this meant we were confined to our hotels for the duration, but most of us found that a few English pounds or US dollars would hire us a taxi for the day, and we went out in small groups and got to see some of the local sites, markets and so forth. Great fun. The problem arose when we returned to the airport the following evening.

We were assembled in a large room in order to have our passports returned and to go through the customs and 'emigration' procedures. A very pleasant Indian Customs official, complete with a uniform that wouldn't have looked out of place on the Captain of the Titanic turned up after about an hour (a short delay by sub-continental standards:), and announced that he had our passports. Three, somewhat less resplendently dressed sub-officals came in with 4 large black bin bags containing the 300+ (from 20+ countries) passports. These were placed upon a large trestle table erected for the purpose and the official proceeded to reach into the first bag, remove a passport, open the cover and read out the name of the owner who was to move forward, be identified and retrieve their passport.

The problem was that with the nice officials fairly strong subcontinental accent, names (often phonetic translations) from 20 odd countries ranging from China, Malaysia, Australia & New Zealand through Abu Dhabi, Bahrain and Egypt, to Sweden, France, Greece, Spain and the UK, the pronunciations left something to be desired. Hearing and interpreting your own name when spoken by a non-your-language speaker is itself quite difficult, but when your surrounded by 300 other non-native speakers all questioning each other as to whether that last, staccato collection of consonants intermingled with sing-song vowel sounds was their name or not, it became incredibly confusing and difficult. It got worse -- much worse -- and the flight eventually took off some 5-hours later, but the rest of the story doesn't have relevance :)

I guess my point is that I've seen various attempts at providing a common, platform-independant mechanism for communications between systems, and so far none of them really live up to the hype. I fully understand the need for such an animal and support the aims, but the implementations leave so much to be desired. The problem is that you either end up with the lowest common denominator which results in complex and sophisticated systems talking to each other in terms of simplistic, verb-adverb-adjective sentences, which is a bit like a Russian and Chinese nuclear scientists communicating to each other via English baby-talk. Or you get a intermediate communications protocol that is so complex, as to allow the most sophisticated ideas and concepts from any proprietary system to be communicated to any other. A fully-defined, orthogonal and extensible protocol -- like XSLT.

The result is that every communicator has to implement detection and recovery procedures for every conceivable language construction, even if it will never use those constructions itself, or would be capable of processing them if it received them. That often leads to the situation where it becomes policy for companies and organisations to adopt such protocols "for all inter-systems communications", even when those systems are their own, similar, never-will-talk-to-the-outside-world, systems. This imposes a huge burden on both the development and runtime for these systems and can lead to dumbing down or castration of individual systems design, because the need to be able to translate all internal data structures and concepts into the intermediate protocol prevents unique and complex (but fitting) structures and concepts being used.

A final image

For a final image, imagine a brain surgeon trying to perform his trade using 30 foot long poles to prod the lower-lumbar regions of proxy-surgeons that enter commands on keyboards that control industrial robots that actually perform the brain surgery.

Trying to perform many of the types of transformations required by inter-systems communication -- date-format; numeric-format; case, codepage and language conversions etc. bits and bytes stuff that most computer systems handle easily and efficiently -- using a "program" written in XML, seems somewhat analogous :)

As you might have gathered, I'm not particularly impressed by XSLT. I see the need for it in some particular circumstances, but in 90% of cases, there is no need to divorce the logic from the underlying systems quite so completely. Most concepts in computers are transferable between individual systems without resorting to a protocol that is so far removed from the underlying mechanisms. For the 10% that do require such machinations, there has to be a better way. I don't know it yet, but I'm pretty sure it will be along some time soon :)

My conclusion is that you shouldn't resort to such mechanisms unless you have a real need to, and if you have, I commiserate with you.


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail

Replies are listed 'Best First'.
Re^2: What's Your Mental Image of XSLT?
by Aristotle (Chancellor) on Jul 22, 2006 at 20:30 UTC

    Having now written a fair bit of XSLT, all I can say is that this is such a grandiosely melodramatic image as to be ridiculous. It’s as if someone was composing an intricately elaborate image of how writing Perl was like herding cats that chase mice running over wires in order to produce just the right line noise to get a working program – or some such absurd preconceived notion.

    The problem is, I’ve never seen introductory material that manages to do proper justice to the language in its unmatched expressiveness and conciseness when manipulating XML documents. Most people get blinded by the superficial verbosity of the syntax as expressed in XML – which I hate as much as anyone –, and never realise the beauty and elegance of the semantics that the syntax expresses.

    Makeshifts last the longest.

      ... its unmatched expressiveness and conciseness when manipulating XML documents.

      You obviously haven't tried doing anything other than very simple translations and substitutions. Try doing something that expands one element into a number of element groups; or collating a large number of groups in order to produce summary statistics; and see any elegance (which I never perceived), and any pretence at conciseness disappear.

      But mostly you are missing that an XML document is never the final form required by an application. Try loading a wordprocessor document from it's native (binary) format, and the same document from an XML representation and see how much extra time/cpu is used by the later. Same thing for spreadsheet data, and rdbms data, etc.

      Try performing SQL type outer, inner or cross joins on tabular data held in XML format using XSLT. Then tell me that it is elegant and concise.


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

        Yes, obviously, because I didn’t share your experience, I must not have tried anything non-trivial.

        I’m not sure what the extra CPU consumed by XML formats over binary data has to do with XSLT being expressive.

        FWIW, all documents in word processor formats are impossibly bloated, and casting them as XML makes them only more so; I wouldn’t want to try to get anything out of them, and that’s just the same no matter if I was processing them with XSLT or Perl. OTOH, I’ve processed some pretty complex SVG and XSL-FO documents, and it wasn’t particularly unpleasant.

        I wouldn’t do complex SQL-type joins in Perl; not sure why I should start doing them in XSLT. (Not sure why I’d be sticking purely tabular data in XML anyway; that’s not what it’s for.) For simple correlation of bits from the document, I’ve not had any particular trouble. But it’s hard to know just what kind of data and operation you’re talking about here without any examples.

        Makeshifts last the longest.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://298458]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2024-04-19 21:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found