I don't know about XPS, but for XSLT, I think this is your culprit. In A::A::Language::LibXSLT.pm at line 129-133, you see this:
if ($last_in_chain && $XML::LibXSLT::VERSION >= 1.03) {
my $encoding = $stylesheet->output_encoding;
my $type = $stylesheet->media_type;
$r->content_type("$type; charset=$encoding");
}So this sets the content_type for this request, which originally was "changeme". The problem is that this is ALWAYS set. So even if you don't specify an output encoding in your stylesheet, your content type becomes something like "text/html; charset=UTF-8".
Now, for OutputCharset to take effect, you need $r->content_type() to stay as "changeme" here, circa line 790 in AxKit.pm:
if ($r->content_type eq 'changeme' && !$r->notes('axkit_passthru_type')) {
$AxKit::Cfg->AllowOutputCharset(1);
$r->content_type('text/html; charset=' . ($AxKit::Cfg->OutputCharset ||
"UTF-8"));
}
elsif ($r->notes('axkit_passthru_type')) {
$r->content_type($AxKit::OrigType);
}
I'm not sure what the original intent was, but it almost seems like that if AxOutputCharset was ever set, AxKit needs to forcefully change the charset, instead of checking for this "changeme" flag which is never set to "changeme" if you use a XSL stylesheet.
Until this is somehow fixed, I guess you're going to need to rely on your last XSL stylesheet to have an <output /> tag that defines encoding="shift-jis". I can think of other hacks too, but I'm afraid that might break something else...
--d
Tomoko OHOYA wrote:
Hi,
I upgraded AxKit to 1.6.1,and AxOutputCharset doesn't work. XSLT ignore AxOutputCharset and output UTF-8. XPS output nothing to browser.
I installed on FreeBSD 4.7 by ports. when I installed 1.6 by ports, AxOutputCharset does work but AxKit doesn't recognize cache already exist. after upgrading to 1.6.1 cache work but AxOutputCharset doesn't work.
With AxTraceIntermediate /home/axkit-trace, axkit-trace folder contains _2ftest_2fcamel.xml.0(Shift_JIS) and _2ftest_ 2fcamel.xml.1(UTF-8).
% iconv -f utf-8 -t shift_jis _2ftest_2fcamel.xml.1 > newfile produce shif_jis file without error.
###### XSLT ----------------------------------------------------------------
[Fri Feb 28 13:10:55 2003] [warn] Apache does not support line-end comments. Consider using quotes around argument: "#default"
[Fri Feb 28 13:10:55 2003] [warn] [client 192.168.1.41] [AxKit] fast handler called for /test/camel2.xml
[Fri Feb 28 13:10:55 2003] [warn] [client 192.168.1.41] [AxKit] Content Provider Override: Apache::AxKit::Provider::File
[Fri Feb 28 13:10:55 2003] [warn] [client 192.168.1.41] [AxKit] decoding from UTF-8
[Fri Feb 28 13:10:55 2003] [warn] [client 192.168.1.41] [AxKit] [req] File Provider given $r: /home/docs/test/camel2.xml
[Fri Feb 28 13:10:55 2003] [warn] [client 192.168.1.41] [AxKit] checking if we process this resource
[Fri Feb 28 13:10:55 2003] [warn] [client 192.168.1.41] [AxKit] media: screen, preferred style: #default
[Fri Feb 28 13:10:55 2003] [warn] [client 192.168.1.41] [AxKit] Cache: key = a0d2ed7466be7b4ad641a5358a35ec15
[Fri Feb 28 13:10:55 2003] [warn] [client 192.168.1.41] [AxKit] getting styles and external entities from the XML
[Fri Feb 28 13:10:55 2003] [warn] [client 192.168.1.41] [AxKit] styles not cached - calling $provider->get_styles()
[Fri Feb 28 13:10:55 2003] [warn] [client 192.168.1.41] [AxKit] using XS get_styles (libxml2)
[Fri Feb 28 13:10:55 2003] [warn] [client 192.168.1.41] [AxKit] encoding to UTF-8
[Fri Feb 28 13:10:55 2003] [warn] [client 192.168.1.41] [AxKit] calling xs_get_styles_fh()
[Fri Feb 28 13:10:55 2003] [warn] [client 192.168.1.41] [AxKit] calling xs_get_styles_str()
[Fri Feb 28 13:10:55 2003] [warn] [client 192.168.1.41] [AxKit] parse_pi: href = camel.xsl
[Fri Feb 28 13:10:55 2003] [warn] [client 192.168.1.41] [AxKit] parse_pi: type = text/xsl
[Fri Feb 28 13:10:55 2003] [warn] [client 192.168.1.41] [AxKit] xs_get_styles returned: , , dromedaries
[Fri Feb 28 13:10:55 2003] [warn] [client 192.168.1.41] [AxKit] Calling GetMatchingProcessors with (screen, , , , dromedaries)
[Fri Feb 28 13:10:55 2003] [warn] [client 192.168.1.41] [AxKit] get_styles: loading style modules
[Fri Feb 28 13:10:55 2003] [warn] [client 192.168.1.41] [AxKit] get_styles: looking for mapping for style type: 'text/xsl'
[Fri Feb 28 13:10:55 2003] [warn] [client 192.168.1.41] [AxKit] cache doesn't exist
[Fri Feb 28 13:10:55 2003] [warn] [client 192.168.1.41] [AxKit] some condition failed. recreating output
[Fri Feb 28 13:10:55 2003] [warn] [client 192.168.1.41] [AxKit] styles: Apache::AxKit::Language::LibXSLT(camel.xsl)
[Fri Feb 28 13:10:55 2003] [warn] [client 192.168.1.41] [AxKit] Style Provider Override: Apache::AxKit::Provider::File
[Fri Feb 28 13:10:55 2003] [warn] [client 192.168.1.41] [AxKit] [uri] File Provider looking up uri camel.xsl
[Fri Feb 28 13:10:55 2003] [warn] [client 192.168.1.41] [AxKit] [uri] File Provider set filename to /home/docs/test/camel.xsl
[Fri Feb 28 13:10:55 2003] [warn] [client 192.168.1.41] [AxKit] about to execute: Apache::AxKit::Language::LibXSLT::handler
[Fri Feb 28 13:10:55 2003] [warn] [client 192.168.1.41] [AxKit] [LibXSLT] getting the XML
[Fri Feb 28 13:10:55 2003] [warn] [client 192.168.1.41] [AxKit] [LibXSLT] parsing stylesheet
[Fri Feb 28 13:10:55 2003] [warn] [client 192.168.1.41] [AxKit] [LibXSLT] parsing stylesheet /test/camel.xsl
[Fri Feb 28 13:10:55 2003] [warn] [client 192.168.1.41] [AxKit] [LibXSLT] performing transformation
[Fri Feb 28 13:10:55 2003] [warn] [client 192.168.1.41] [AxKit] [LibXSLT] transformation finished, creating XML::LibXML::Document=SCALAR(0x8715c54)
[Fri Feb 28 13:10:55 2003] [warn] [client 192.168.1.41] [AxKit] [LibXSLT] outputting to $r
[Fri Feb 28 13:10:55 2003] [warn] [client 192.168.1.41] [AxKit] [LibXSLT] storing results in pnotes(dom_tree) (AxKit::Apache=SCALAR(0x83d48e4))
[Fri Feb 28 13:10:55 2003] [warn] [client 192.168.1.41] [AxKit] Apache::AxKit::Language::LibXSLT::handler finished with code 0
[Fri Feb 28 13:10:55 2003] [warn] [client 192.168.1.41] [AxKit] execution of: Apache::AxKit::Language::LibXSLT::handler finished
[Fri Feb 28 13:10:55 2003] [warn] [client 192.168.1.41] [AxKit] Cache: key = 87495090ca08d1ca3d11c19c0ce69a3a
[Fri Feb 28 13:10:55 2003] [warn] [client 192.168.1.41] [AxKit] [Cache] writing cache file /home/cache/87/49/5090ca08d1ca3d11c19c0ce69a3a
[Fri Feb 28 13:10:55 2003] [warn] [client 192.168.1.41] [AxKit] delivering to browser
[Fri Feb 28 13:10:55 2003] [warn] [client 192.168.1.41] [AxKit] Delivering xml_string
[Fri Feb 28 13:10:55 2003] [warn] [client 192.168.1.41] [AxKit] writing xml string to cache and delivering to browser
[Fri Feb 28 13:10:55 2003] [warn] [client 192.168.1.41] [AxKit] [Cache] writing cache file /home/cache/a0/d2/ed7466be7b4ad641a5358a35ec15
[Fri Feb 28 13:10:55 2003] [warn] [client 192.168.1.41] [AxKit] Cache: Getting content-type
[Fri Feb 28 13:10:55 2003] [warn] [client 192.168.1.41] [AxKit] Cache: setting content-type: text/html; charset=UTF-8
[Fri Feb 28 13:10:55 2003] [warn] [client 192.168.1.41] [AxKit] Cache: Sending untransformed content to browser
###### XSP ----------------------------------------------------------------
[Fri Feb 28 13:17:26 2003] [warn] Apache does not support line-end comments. Consider using quotes around argument: "#default"
[Fri Feb 28 13:17:26 2003] [warn] [client 192.168.1.41] [AxKit] fast handler called for /test/camel.xml
[Fri Feb 28 13:17:26 2003] [warn] [client 192.168.1.41] [AxKit] Content Provider Override: Apache::AxKit::Provider::File
[Fri Feb 28 13:17:26 2003] [warn] [client 192.168.1.41] [AxKit] decoding from UTF-8
[Fri Feb 28 13:17:26 2003] [warn] [client 192.168.1.41] [AxKit] [req] File Provider given $r: /home/docs/test/camel.xml
[Fri Feb 28 13:17:26 2003] [warn] [client 192.168.1.41] [AxKit] checking if we process this resource
[Fri Feb 28 13:17:26 2003] [warn] [client 192.168.1.41] [AxKit] media: screen, preferred style: #default
[Fri Feb 28 13:17:26 2003] [warn] [client 192.168.1.41] [AxKit] Cache: key = 206ff30beb9095387c37d821635930a9
[Fri Feb 28 13:17:26 2003] [warn] [client 192.168.1.41] [AxKit] getting styles and external entities from the XML
[Fri Feb 28 13:17:26 2003] [warn] [client 192.168.1.41] [AxKit] styles not cached - calling $provider->get_styles()
[Fri Feb 28 13:17:26 2003] [warn] [client 192.168.1.41] [AxKit] using XS get_styles (libxml2)
[Fri Feb 28 13:17:26 2003] [warn] [client 192.168.1.41] [AxKit] encoding to UTF-8
[Fri Feb 28 13:17:26 2003] [warn] [client 192.168.1.41] [AxKit] calling xs_get_styles_fh()
[Fri Feb 28 13:17:26 2003] [warn] [client 192.168.1.41] [AxKit] calling xs_get_styles_str()
[Fri Feb 28 13:17:26 2003] [warn] [client 192.168.1.41] [AxKit] parse_pi: href = camel.xps
[Fri Feb 28 13:17:26 2003] [warn] [client 192.168.1.41] [AxKit] parse_pi: type = application/x-xpathscript
[Fri Feb 28 13:17:26 2003] [warn] [client 192.168.1.41] [AxKit] xs_get_styles returned: , , dromedaries
[Fri Feb 28 13:17:26 2003] [warn] [client 192.168.1.41] [AxKit] Calling GetMatchingProcessors with (screen, , , , dromedaries)
[Fri Feb 28 13:17:26 2003] [warn] [client 192.168.1.41] [AxKit] get_styles: loading style modules
[Fri Feb 28 13:17:26 2003] [warn] [client 192.168.1.41] [AxKit] get_styles: looking for mapping for style type: 'application/x-xpathscript'
[Fri Feb 28 13:17:26 2003] [warn] [client 192.168.1.41] [AxKit] cache doesn't exist
[Fri Feb 28 13:17:26 2003] [warn] [client 192.168.1.41] [AxKit] some condition failed. recreating output
[Fri Feb 28 13:17:26 2003] [warn] [client 192.168.1.41] [AxKit] styles: Apache::AxKit::Language::XPathScript(camel.xps)
[Fri Feb 28 13:17:26 2003] [warn] [client 192.168.1.41] [AxKit] Style Provider Override: Apache::AxKit::Provider::File
[Fri Feb 28 13:17:26 2003] [warn] [client 192.168.1.41] [AxKit] [uri] File Provider looking up uri camel.xps
[Fri Feb 28 13:17:26 2003] [warn] [client 192.168.1.41] [AxKit] [uri] File Provider set filename to /home/docs/test/camel.xps
[Fri Feb 28 13:17:26 2003] [warn] [client 192.168.1.41] [AxKit] about to execute: Apache::AxKit::Language::XPathScript::handler
[Fri Feb 28 13:17:26 2003] [warn] [client 192.168.1.41] [AxKit] XPathScript: Getting XML Source
[Fri Feb 28 13:17:26 2003] [warn] [client 192.168.1.41] [AxKit] XPathScript: reparsing file
[Fri Feb 28 13:17:26 2003] [warn] [client 192.168.1.41] [AxKit] XPathScript: Returning parsed source tree
[Fri Feb 28 13:17:26 2003] [warn] [client 192.168.1.41] [AxKit] Checking stylesheet mtime: 1046404620
[Fri Feb 28 13:17:26 2003] [warn] [client 192.168.1.41] [AxKit] Recompiling stylesheet: /home/docs/test/camel.xps
[Fri Feb 28 13:17:26 2003] [warn] [client 192.168.1.41] [AxKit] XPathScript: extracting from '/home/docs/test/camel.xps' contents: <%
$t->{'humps'}{'pre'} = "<td>";
$t->{'humps'}{'post'} = "</td>";
$t->{'disposition'}{'pre'} = "<td>";
$t->{'disposition'}{'post'} = "</td>";
$t->{'species'}{testcode} = sub {
my $node = shift;
my $t = shift;
$t->{pre} = '<tr><td>' . findvalue('@name', $node) . '</td>';
$t->{post} = '</tr>';
return 1;
}
%>
<html>
<head>
<title>Know Your Dromedaries</title>
</head>
<body bgcolor="white">
<table bgcolor="eeeeee" border="1">
<tr><th>Species</th><th>No. of Humps</th><th>Disposition</th></tr>
<%= apply_templates('/dromedaries/species') %>
</table>
</body>
</html>
[Fri Feb 28 13:17:26 2003] [warn] [client 192.168.1.41] [AxKit] Compiling script:
package Apache::AxKit::Language::XPathScript::ROOT::home::docs::test::camel_2exps; use Apache qw(exit);use XML::XPath::Node;Apache::AxKit::Language::XPathScript::Toys->import;sub handler {my ($r, $xp, $t) = @_;
#line 1 /home/docs/test/camel.xps
print q||;
#line 1 /home/docs/test/camel.xps
$t->{'humps'}{'pre'} = "<td>"; $t->{'humps'}{'post'} = "</td>"; $t->{'disposition'}{'pre'} = "<td>"; $t->{'disposition'}{'post'} = "</td>"; $t->{'species'}{testcode} = sub { my $node = shift; my $t = shift; $t->{pre} = '<tr><td>' . findvalue('@name', $node) . '</td>'; $t->{post} = '</tr>'; return 1; }; print q| <html> <head> <title>Know Your Dromedaries</title> </head> <body bgcolor="white"> <table bgcolor="eeeeee" border="1"> <tr><th>Species</th><th>No. of Humps</th><th>Disposition</th></tr> |; #line 21 /home/docs/test/camel.xps print(do { apply_templates('/dromedaries/species') }); print q| </table> </body> </html> |;; return Apache::Constants::OK; }
[Fri Feb 28 13:17:26 2003] [warn] [client 192.168.1.41] [AxKit] Running XPathScript script
[Fri Feb 28 13:17:26 2003] [warn] [client 192.168.1.41] [AxKit] Apache::AxKit::Language::XPathScript::handler finished with code 0
[Fri Feb 28 13:17:26 2003] [warn] [client 192.168.1.41] [AxKit] execution of: Apache::AxKit::Language::XPathScript::handler finished
[Fri Feb 28 13:17:26 2003] [warn] [client 192.168.1.41] [AxKit] Cache: key = b0dbe7dbcb714a6cea99033604ef9d8c
[Fri Feb 28 13:17:26 2003] [warn] [client 192.168.1.41] [AxKit] [Cache] writing cache file /home/cache/b0/db/e7dbcb714a6cea99033604ef9d8c
[Fri Feb 28 13:17:26 2003] [warn] [client 192.168.1.41] [AxKit] delivering to browser
[Fri Feb 28 13:17:26 2003] [warn] [client 192.168.1.41] [AxKit] Delivering xml_string
[Fri Feb 28 13:17:26 2003] [warn] [client 192.168.1.41] [AxKit] writing xml string to cache and delivering to browser
[Fri Feb 28 13:17:26 2003] [warn] [client 192.168.1.41] [AxKit] [Cache] writing cache file /home/cache/20/6f/f30beb9095387c37d821635930a9
[Fri Feb 28 13:17:26 2003] [warn] [client 192.168.1.41] [AxKit] Cache: Getting content-type
[Fri Feb 28 13:17:26 2003] [warn] [client 192.168.1.41] [AxKit] Cache: Transforming content and printing to browser
// Tomoko OHOYA // [EMAIL PROTECTED] // http://www.kcn.ne.jp/~idic/
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
