Bug 38781 - jsdk 1.5 xml xslt charset
Summary: jsdk 1.5 xml xslt charset
Status: RESOLVED INVALID
Alias: None
Product: Ant
Classification: Unclassified
Component: Core tasks (show other bugs)
Version: 1.6.5
Hardware: PC All
: P1 major (vote)
Target Milestone: ---
Assignee: Ant Notifications List
URL:
Keywords: XSLTBug
Depends on:
Blocks:
 
Reported: 2006-02-24 20:31 UTC by DMoL
Modified: 2008-11-24 08:20 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description DMoL 2006-02-24 20:31:59 UTC
I think ant works incorrectly when processing xslt, particullary the charset of
output file IS NOT windows-1251

ant build.xml
=============
  <xslt in="source.xml" out="out.xml" style="style.xslt">
    <outputproperty name="method" value="html"/>
    <outputproperty name="encoding" value="Windows-1251" /> 
  </xslt>
=============

source.xml
=============
<?xml version="1.0" encoding="windows-1251" ?>
<ur-document>
Äîêóìåíò
</ur-document>
=============

style.xslt
=============
<?xml version='1.0' encoding='windows-1251'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html" version="4.0" encoding="windows-1251" indent="yes" />
<xsl:param name="lang" select="'rus'" />
<xsl:template match="/ur-document">
	<html> 
	 <title>
	  Íàçâàíèå : <xsl:value-of select="."/>
	 </title>
	</html>
</xsl:template>
</xsl:stylesheet>
=============
Comment 1 Alexey Solofnenko 2006-02-24 20:48:22 UTC
The output is in UTF-8.
Comment 2 Alexey Solofnenko 2006-02-24 20:56:41 UTC
Actually Unicode. Try replacing "Windows-1251" with a bogus value and you will
see: [xslt] Warning: encoding "aaa" not supported, using UTF-8. The resulting
file is in correct Windows-1251 encoding, but valid Windows-1251 characters are
encoded additionally. The output should work fine in the current form, if file
size is not an issue.
Comment 3 DMoL 2006-02-24 21:23:22 UTC
(In reply to comment #2)
> Actually Unicode. Try replacing "Windows-1251" with a bogus value and you will
> see: [xslt] Warning: encoding "aaa" not supported, using UTF-8. The resulting
> file is in correct Windows-1251 encoding, but valid Windows-1251 characters are
> encoded additionally. The output should work fine in the current form, if file
> size is not an issue.

Ok. Many thanks. But how can I (In reply to comment #2)
> Actually Unicode. Try replacing "Windows-1251" with a bogus value and you will
> see: [xslt] Warning: encoding "aaa" not supported, using UTF-8. The resulting
> file is in correct Windows-1251 encoding, but valid Windows-1251 characters are
> encoded additionally. The output should work fine in the current form, if file
> size is not an issue.


Thank you. But how can I reach the behavior on jdk1.4 when output is "windows-1251"?
Comment 4 Alexey Solofnenko 2006-02-24 21:26:54 UTC
I do not think there is anything can be done in ANT. It is up to XSLT library to
encode output. Why not to use UTF-8?
Comment 5 Steve Loughran 2006-02-25 19:09:38 UTC
If this problem only arises in java1.5, then it is probably due to the XSLT
engine that ships with java1.5. Try adding Xalan to your ant lib directory and
seeing what you can do to explicitly ask for it, if it is not picked up
automatically.
Comment 6 DMoL 2006-02-25 19:58:29 UTC
(In reply to comment #5)
I put xalan.jar to ants lib directory, but output file didn't changed. 
(paremeter processor="xalan" - is deprecated in ant 1.6.5)
Comment 7 Steve Loughran 2006-07-04 20:41:00 UTC
DMoL, in reply to comment #6, try setting the factory instead, with

<factory name="org.apache.xalan.processor.TransformerFactoryImpl"/>

this forces xalan into action, not xsltc. Let us know what happens.
Comment 8 DMoL 2006-07-05 17:07:10 UTC
(In reply to comment #7)
> DMoL, in reply to comment #6, try setting the factory instead, with
> <factory name="org.apache.xalan.processor.TransformerFactoryImpl"/>
> this forces xalan into action, not xsltc. Let us know what happens.

I have changed build.xml to this, but output still the same (incorrect, not cp-1251)
	 <xslt in="source.xml" out="out.xml" style="style.xslt">
	    <factory name="org.apache.xalan.processor.TransformerFactoryImpl"/>
	  </xslt>
Comment 9 Stefan Bodewig 2008-11-24 08:20:26 UTC
you don't need to specify any factory and not fiddle with ant/lib, you should install the latest version of Xalan using the endorsed standards override mechanism[1].

JDK 1.5's XSLT engine is seriously broken and you'll be happy to have it replaced.

Not an Ant bug anyway.

[1] http://xml.apache.org/xalan-j/faq.html#faq-N100EF