> One thing we could do would be to put another accessor on XalanTransformer
> to return the actual encoding of the last transformation.  If that sounds
> reasonable to you, please file a bugzilla request for an enhancement.
Yes, that's about the only reasonable way that I could think of.  I'd like
to get hold of the output method as well as encoding (as it's perfectly
feasible for someone to transform a document to text/xml or text/plain), but
that can be handled in the same way.

I guess the other method is to have XalanTransformer sprout additional
transform() methods or optional parameters that can store the output
encoding and method where required by the caller.

> I
> would welcome other opinions as to how to approach this.  As a temporary
> workaround, you can determine the output encoding by trying to create a
> transcoder for the encoding specified in the stylesheet (or for the
> encoding specified in XSLTResultTarget or XalanTransformer, if you're
> trying to force the encoding).  If that fails, because we cannot support
> the encoding, you can then assume the encoding is UTF-8.
>
Part of the issue is that I don't have a clue what that encoding is.  To get
at that, I'd need to parse the stylesheet and then go digging around in it.
Alternatively I can go grepping around the meta tags in the output (assuming
that it is html), but that's really fuggly.

If there aren't any objections, I'll file an enhancement and have a go at
adding getLastOutputEncoding() and getLastOutputMethod().

Thanks,

Mark

Reply via email to