It looks very like this bug, which was fixed in
Michael Kay

From: Cuzner Stephen P []
Sent: 24 February 2009 19:53
To: Mailing list for the SAXON XSLT and XQuery processor
Subject: [saxon] Charater maps problem

I was working on this a bit in November but couldn't get anywhere with it. It is now causing me a serious roadblock. I've simplified things significantly to illustrate the problem. When I run this stylehseet:
<?xml version="1.0"?>
xsl:stylesheet version="2.0" xmlns:xsl="">
    <xsl:character-map name="htmlchars">
        <xsl:output-character character="&#x2002;" string="&amp;nbsp;" />
        <xsl:output-character character="&#x2003;" string="&amp;nbsp;" />
        <xsl:output-character character="&#x2007;" string="&amp;nbsp;" />

    <xsl:output indent="yes" doctype-public="-//W3C//DTD HTML 4.0 Transitional//EN" encoding="us-ascii" method="html" omit-xml-declaration="yes" use-character-maps="htmlchars" version="4.0"/>
    <xsl:template match="/">
        <html><head><title>test charmap</title></head>
        <p>this is a test of chapmaps</p>


Through this java:
package gov.irs.TFPOnlineProcessing;
import net.sf.saxon.s9api.Processor;
import net.sf.saxon.s9api.QName;
import net.sf.saxon.s9api.SaxonApiException;
import net.sf.saxon.s9api.Serializer;
import net.sf.saxon.s9api.XdmAtomicValue;
import net.sf.saxon.s9api.XdmNode;
import net.sf.saxon.s9api.XdmValue;
import net.sf.saxon.s9api.XsltCompiler;
import net.sf.saxon.s9api.XsltExecutable;
import net.sf.saxon.s9api.XsltTransformer;
public class SimpleTrans {
 static final String version = "$Revision: 1.1 $";
  * @param args
 public static void main(String[] args) {
  // TODO Auto-generated method stub
  try {
  Processor proc = new Processor(false);
  XsltCompiler comp = proc.newXsltCompiler();
  XdmNode ss = proc.newDocumentBuilder().build(new File("C:/lib/xslt/charmap-test.xsl"));
  XsltExecutable exp = comp.compile(ss.asSource());
  XdmNode source = proc.newDocumentBuilder().build(new File("c:/htmlinput/p17.dxml"));
  Serializer out = new Serializer();
  //out.setOutputProperty(Serializer.Property.METHOD, "xml");
  out.setOutputFile(new File("c:/chartest.xml"));
  XsltTransformer trans = exp.load();
  catch (SaxonApiException sae) {

I get this error message

net.sf.saxon.s9api.SaxonApiException: Cannot use character maps in an environment with no Controller

at net.sf.saxon.s9api.Serializer.getReceiver(

at net.sf.saxon.s9api.XsltTransformer.transform(

at gov.irs.TFPOnlineProcessing.SimpleTrans.main(

Caused by: net.sf.saxon.trans.XPathException: Cannot use character maps in an environment with no Controller

at net.sf.saxon.event.SerializerFactory.getReceiver(

at net.sf.saxon.s9api.Serializer.getReceiver(

... 2 more


Does anyone have any ideas on how to fix this?