[xsl] May be fun for you ....

Subject: [xsl] May be fun for you ....
From: daniel whitney <dbf.whitney@xxxxxxxxx>
Date: Mon, 16 May 2011 15:56:47 -0400
Haven't posted here in a while, but here's something that had me
baffled. A co-worker came to me and said that she was converting XML
to text and couldn't understand why her special characters were coming
out with a strange character in front of them. I did a transform using
Saxon 6.5.3 and sure enough the output was like this:

B%3,000,000<tab>B%3,000,000
B#30,000<tab>B#23,250

That's an easy one, I thought, she's outputting UTF. I quickly checked
the encoding, saw iso-8859-1 - that wasn't the problem.  Checked the
rest of the XSL files, they appeared fine. Checked the XML file,
seemed fine as well. Pulled both the XSL and XML into a hex editor,
see if there was some funny hidden character. Nothing. Was turning
into a real head scratcher. Desperate times called for desperate
measure - so thinking outside of the box, and daring the unthinkable,
I changed the output method from "text" to "xml". Of course the same
problem. At this point I was running out of options. I showed the
co-worker the transformed XML file, explaining to her that everything
looked fine, when I got my first clue: the XML declaration showed:
<?xml version="iso-8859-1" encoding="utf-8"?>. Very strange ... Going
back to the XSL file I saw the problem. The <xsl:output element looked
like this: <xsl:output method="text" indent="yes"
version="iso-8859-1"/>. Of course in my zeal to find the quick answer
and prove my XML expertise, I saw the iso-8859-1 attribute value but
didn't bother checking the attribute itself.

I'm sure there's some witty moral to this story ... anyone. For my
part ... details - Details - DETAILS.

Dan

Current Thread