I am working on a project in which I use XML files.
I wrote an JavaServlet which reads an XML and an XSL file and creates an HTML file.
My XML and XSL files contain Turkish characters (Turkish encoding is ISO-8859-9).
These characters are displayed as a question mark (?).
I have tried many solutions but couldn't fix the problem. I attached the codes so that you can see what is going on.
I am using Windows XP
Java 1.4.2_03
Xalan-Java 2.5
Xerces-J 1.4.4
Tomcat
------------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?> <?xml-stylesheet type="text/xsl" href="D:\Tomcat\webapps\book\WEB-INF\source\xml\index.xsl"?> <categories xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="D:\Tomcat\webapps\book\WEB-INF\source\xml\kategori.xsd"> <category> <category_name>isletim sistemleri</category_name> <category_id>100</category_id> <sub_category> <subcategory_name>Unix</subcategory_name> <subcategory_id>100</subcategory_id> </sub_category> <sub_category> <subcategory_name>Linux</subcategory_name> <subcategory_id>101</subcategory_id> </sub_category> </category> </categories>
------------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/" priority="11"> <html> <head> <title>:::LeoFibo.NET:::</title> <link rel="stylesheet" href="../dimages/format.css" Type="text/css"/> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <meta name="description" content="Leofibo.NET..IT PORTALI"/> <meta http-equiv="Content-Language" content="tr"/> <meta name="keywords" content="kitap, bilgisayar"/> </head>
<body bgcolor="#FFFFFF" background="../dimages/arkaplan.gif" leftmargin="0" topmargin="0">
<table border="0" width="750" cellpadding="0" cellspacing="0"> <tr> <td bgcolor="#cccccc" width="600"><img src="../dimages/trans.gif" border="0" width="500" height="20"></img></td> <td bgcolor="#cccccc" width="30"><img src="../dimages/kart.gif" width="20" height="20" alt="Alisveris Sepetiniz" border="0"></img></td> <td width="16"><img src="../dimages/sag_ust_kose.gif"></img></td> </tr> </table>
<table border="0" width="750" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#0099CC"><div class="anasayfa_slogan">Leofibo.NET</div></td>
</tr>
</table>
<table border="0" width="750" cellpadding="0" cellspacing="0" height="40"> <tr> <td bgcolor="#336699" width="500"><img src="../dimages/trans.gif" border="0" width="500" height="20"></img></td> <td bgcolor="#336699" width="50"><div class="arama_baslik">ARAMA</div></td> <td bgcolor="#336699" width="30"><select class="secimler"><option>ISBN</option><option>Baslik</option></select></td> <td bgcolor="#336699" width="90"><input type="text" class="arama"></input></td> <td bgcolor="#336699" width="30"><input type="submit" class="arama2" value="ara"></input></td> <td bgcolor="#336699" width="10"><img src="../dimages/trans.gif" border="0" width="10" height="1"></img></td> </tr> </table>
<xsl:apply-templates /> <table border="0" width="750" cellpadding="0" cellspacing="0"> <tr> <td bgcolor="#0099CC"><img src="../dimages/trans.gif" border="0" width="1" height="20"></img></td> </tr> </table> <table border="0" width="750" cellpadding="0" cellspacing="0"> <tr> <td bgcolor="#cccccc"><img src="../dimages/trans.gif" border="0" width="1" height="20"></img></td> </tr> </table> </body> </html> </xsl:template>
<xsl:template match="special"> </xsl:template>
</xsl:stylesheet>
------------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?> <!-- edited with XMLSPY v2004 rel. 3 U (http://www.xmlspy.com) by metin zavrak (sabanci) --> <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:include href="topinclude.xsl"/> <xsl:template match="categories"> <table border="0" width="750" cellpadding="0" cellspacing="0" bgcolor="#336699"> <tr> <td valign="top"> <table width="180"> <xsl:for-each select="category"> <tr> <td valign="top"> <xsl:element name="a"> <xsl:attribute name="href">kategori_browse?id=<xsl:value-of select="category_id"/></xsl:attribute> <div class="menu"> :: <xsl:value-of select="category_name"/> </div> </xsl:element> </td> </tr> </xsl:for-each> </table> </td> <td valign="bottom" align="right"> <img src="../dimages/anasayfa.jpg"/> </td> </tr> <tr> <td valign="top" colspan="2"> <img src="../dimages/anasayfa_alt.jpg"/> </td> </tr> </table> </xsl:template> </xsl:stylesheet>