You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Ashay <as...@yahoo.com> on 2003/06/24 08:53:31 UTC

Otaining output in encodings other than UTF-8

Hi,
I am using Xerces-2.2 and xalan 1.5 integrated with icu 2.4.
I am parsing XML files, transforming the DOM and obtaining the result 
html
in a string for display.
My requirement is to obtain the output html in the requested encoding.
I found that the output encoding can be set by specifying the 
"xsl:output
encoding" parameter in the XSL file.
for eg. <xsl:output encoding="Shift-JIS"/> in the xsl file.
My question is
1) is this enough for obtaining the output in other encodings ?
2) secondly, is it possible for setting the above parameter in the XSL 
file
at runtime through my program.
I am aware of the function setStylesheetParam() for setting parameters 
in
the compiled stylesheet during runtime. I tried this
for setting the above parameter but it doesn't seem to have an effect.
The output is as follows:
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
whereas I get <META http-equiv="Content-Type" content="text/html;
charset=Shift-JIS"> when i explicitly mention the above parameter in 
the
XSL file as Shift-JIS.

I used the following XSL file for setting this parameter at runtime:
-----------------------------------
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:param name="param1"/>
  <xsl:output method="html" encoding="$param1"/>
  <xsl:template match="/">
    <html>
      <head/>
      <xsl:value-of select="."/>
    </html>
  </xsl:template>
</xsl:stylesheet>
-------------------------------------
and then using 
:theTransformer.setStylesheetParam(XalanDOMString("param1"),
XalanDOMString("Shift-JIS"));
Where am I going wrong ?

I would appreciate some detailed help on this.
Thanks in advance
Ashay.
 


---------------------------------
Do you Yahoo!?
Free online calendar with sync to Outlook(TM).