Re: [xsl] best practices, insert PI with XSLT or otherwise?

Subject: Re: [xsl] best practices, insert PI with XSLT or otherwise?
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Wed, 03 Feb 2010 11:43:03 +0100
At 2010-02-03 10:19 +0000, Andrew Welch wrote:
On 3 February 2010 05:35, G. Ken Holman <gkholman@xxxxxxxxxxxxxxxxxxxx> wrote:
> At 2010-02-02 23:14 -0500, Hoskins & Gretton wrote:
>> HI, I have a set of XML files in which I want to insert a processing
>> instruction after the XML declaration. I could use a text function type of
>> "search and replace" or XSLT identity template + override. I work with a
>> Java programmer, so everything can be solved best with Java from her point
>> of view, and I work with XSLT, so you know my preference. Is there ever a
>> reason that a non-XSLT process would be better than XSLT?
> When that Java programmer doesn't know how to work with Unicode.  A couple
> of times now I've supplied a pure XML/XSLT solution to a customer only to
> have them make an 11th hour change using Java in the last mile of delivery
> and having the Java programmer muck up the encoding in the file.
> Reading the XML Declaration (or lack thereof) informs the Java programmer
> about the character set for the rest of the document, but they may not know
> that and just blindly run the file through their "quick and dirty and why
> should I bother debugging such a simple change" program like a bull in a
> china shop breaking things along the way.

It would be rare that the Java programmer would need to determine the
encoding from the xml declaration, they should really be operating on
the parsed content (sax events, some object model etc)

I agree, except that the customers' programmers used byte streams of some kind ... they refused to think of XML as XML but only as a stream of raw data.

It's often because XML appears so simple ("its just angle brackets,
right?") and parsing, manipulating and serialising it with Java such a
pain, that many devs choose to just process it as a string... I reckon
that's the reason behind the majority of requests to preserve entities
in the output.


It was a revelation to me working on a country-wide deployment of XML (the UBL standard in Denmark) when my client was informed that tens of thousands of Java developers wanted to look at the information only as filed-in data structures and not as XML. I don't know how that can be changed.

In the project I cited earlier XSLT drove all of the steps up until the end delivery until a last-minute change prompted the Java developers to inject themselves in the process because they refused to leverage the existing XSLT to add the fix.

How can Java programmers be convinced that XSLT is an appropriate language for XML?

. . . . . . . . . . . . . Ken

XSLT/XQuery/XPath training after 2010-03-15/19
XSLT/XQuery/XPath training:   San Carlos, California 2010-04-26/30
Vote for your XML training:
Crane Softwrights Ltd.
Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video
Video lesson:
Video overview:
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Male Cancer Awareness Nov'07
Legal business disclaimers:

Current Thread