I have reproduced the failure - it seems to occur only when the xsl:output declaration specifies the "method" attribute as well as "use-character-maps". If method is defaulted, it works OK.
 
Michael Kay
http://www.saxonica.com/


From: Cuzner Stephen P [mailto:Stephen.P.Cuzner@irs.gov]
Sent: 14 November 2008 01:46
To: Mailing list for the SAXON XSLT and XQuery processor
Subject: Re: [saxon] Error message using xsl:character-map

I think I may have jumped too quickly here. Using a simple test app:
 
package gov.irs.TFPOnlineProcessing;
 
import java.io.File;
 
import net.sf.saxon.s9api.Processor;
import net.sf.saxon.s9api.SaxonApiException;
import net.sf.saxon.s9api.Serializer;
import net.sf.saxon.s9api.XdmNode;
import net.sf.saxon.s9api.XsltCompiler;
import net.sf.saxon.s9api.XsltExecutable;
import net.sf.saxon.s9api.XsltTransformer;
 
public class SimpleTrans {
 
 /**
  * @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/tipx.xsl"));
  XsltExecutable exp = comp.compile(ss.asSource());
  XdmNode source = proc.newDocumentBuilder().build(new File("c:/p225.dxml"));
  Serializer out = new Serializer();
  out.setOutputProperty(Serializer.Property.METHOD, "xml");
  out.setOutputFile(new File("c:/p225_chartest.xml"));
  XsltTransformer trans = exp.load();
  trans.setInitialContextNode(source);
  trans.setDestination(out);
  trans.transform();
  }
  catch (SaxonApiException sae) {
   sae.printStackTrace();
  }
 }
 
}
 
it works fine. I think what is going on is that I am doing non-xml post processing and serializing to a StringWriter via the setOutputWriter method.


From: Michael Kay [mailto:mike@saxonica.com]
Sent: Thursday, November 13, 2008 6:18 PM
To: 'Mailing list for the SAXON XSLT and XQuery processor'
Subject: Re: [saxon] Error message using xsl:character-map

It looks as if character maps don't work when the transformation output is sent to a s9api Serializer. I will look into it.
 
Michael Kay
http://www.saxonica.com/


From: Cuzner Stephen P [mailto:Stephen.P.Cuzner@irs.gov]
Sent: 13 November 2008 19:58
To: saxon-help@lists.sourceforge.net
Subject: [saxon] Error message using xsl:character-map

I'm getting an error message when I use an xsl 2.0 character-map:
 
net.sf.saxon.s9api.SaxonApiException: Cannot use character maps in an environment with no Controller. I've been digging through the javadoc and the documentation but I can't figure out what I have to do to set things up to allow for the use of character maps. Can anyone get me started?
 
Steve
 
 
My stylesheet starts as follows:
 
<?xml version="1.0"?>
<
xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fn="http://www.w3.org/2005/02/xpath-functions" exclude-result-prefixes="fn"
>
    <xsl:import href="common04.xsl"/
>

    <xsl:import href="table.xsl"/
>

    <xsl:output indent="yes" doctype-public="-//OASIS//DTD DocBook XML V4.2//EN" doctype-system="../../dtd/docbookx.dtd" encoding="UTF-8" method="xml" omit-xml-declaration="no" version="1.0" use-character-maps="AccentureProblems"/
>

    <xsl:character-map name="AccentureProblems"
>
        <xsl:output-character character="&#x2003;" string=" &amp;#x2003;" /
>
        <xsl:output-character character="&#xf3;" string="&amp;#xf3;" /
>
        <xsl:output-character character="&#x2002;" string="&amp;#x2002;" /
>
        <xsl:output-character character="&#x2014;" string="&amp;#x2014;" /
>
        <xsl:output-character character="&#x2007;" string="&amp;#x2007;" /
>
        <xsl:output-character character="&#x2013;" string="&amp;#x2013;" /
>
        <xsl:output-character character="&#x25a1;" string="&amp;#x25a1;" /
>
        <xsl:output-character character="&#x2022;" string="&amp;#x2022;" /
>
        <xsl:output-character character="&#xf7;" string="&amp;#xf7;" /
>
        <xsl:output-character character="&#xe9;" string="&amp;#xe9;" /
>
        <xsl:output-character character="&#x2212;" string="&amp;#x2212;" /
>
        <xsl:output-character character="&#xa0;" string="&amp;#xa0;" /
>
        <xsl:output-character character="&#xae;" string="&amp;#xae;" /
>
    </xsl:character-map>