when I replace the 'global functionality' by adding the saxon8.jar to the whole app (classpath). I get

Error: java.lang.Exception: org.apache.xml.utils.WrappedRuntimeException: The output format must have a '{http://xml.apache.org/xalan}content-handler' property!

So, what must I do, to allow saxon to co-exist, or to specify the saxon jar at rt.

Michael Kay wrote:
It looks as if you aren't loading Saxon. Before you create the
TransformerFactory, add

System.setProperty("java.xml.transform.TransformerFactory",
"net.sf.saxon.TransformerFactoryImpl");

Michael Kay 

  
-----Original Message-----
From: saxon-help-admin@lists.sourceforge.net 
[mailto:saxon-help-admin@lists.sourceforge.net] On Behalf Of Kevin
Sent: 16 July 2004 16:35
To: saxon-help@lists.sourceforge.net
Subject: [saxon] Saxon8 in isolated Class.

I am trying to change the behavior of a class with a code stub like:

        Map properties = clientRequest.getProperties();

        Element message = (Element)clientRequest.getMessageObject();
        String  location =(String) 
properties.get("stylesheetLocation");
        Source source;
        if(location.indexOf("://")!=-1){
            URL url = new URL(location);
            java.io.InputStream in = url.openStream( );
            source = new SAXSource( new InputSource(in) );
        }else{
            source = new SAXSource( new InputSource(location) );
        }
        TransformerFactory tfactory = 
TransformerFactory.newInstance( );
        // Templates templates = tfactory.newTemplates(source);
        Transformer transformer = tfactory.newTransformer(source);
        ByteArrayOutputStream out = new ByteArrayOutputStream( );
        transformer.transform(new DOMSource(message), new 
StreamResult(out));
        ClientResponse cre = new ClientResponse(out.toByteArray( ));
        return cre;

using java:
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b04)
Java HotSpot(TM) Client VM (build 1.4.2_04-b04, mixed mode)

My objective is to use the saxon XSLT 2.0  to transform a 
document with 
this XSLT style sheet:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
version="1.0">
  <xsl:template match="root">
    <xsl:analyze-string select="." 
regex="&lt;B&gt;\s*([0-9]+)\s*\.&lt;/B&gt;\s*(.*)\s*&lt;a\s+HR
EF=&quot;(.*)\s*&quot;&gt;\s*\[(.*)\s*\]\s*&lt;/a&gt;" 
 >
      <xsl:matching-substring>
        <row>
          <data>
            <law><xsl:value-of select="regex-group(1)"/></law>
            <abstract><xsl:value-of 
select="regex-group(2)"/></abstract>
            <url>http://www.baluha.com/data/<xsl:value-of 
select="regex-group(3)"/></url>
            <name><xsl:value-of select="regex-group(4)"/></name>
          </data>
        </row>
      </xsl:matching-substring>
    </xsl:analyze-string>
  </xsl:template>
</xsl:stylesheet>

I would hope to be able to accomplish this by doing a series of 
System.setProperty(...) or some config file changes...
any suggestions. All my attempts yield a rt exception like:
Jul 15, 2004 2:53:17 AM system  WARNING 79       java.lang.Exception: 
javax.xml.transform.TransformerConfigurationException: 
javax.xml.transform.TransformerConfigurationException: 
javax.xml.transform.TransformerException: 
javax.xml.transform.TransformerException: xsl:analyze-string is not 
allowed in this position in the stylesheet!
com.webdeninteractive.xbotts.client.api.server.TransferException: 
java.lang.Exception: 
javax.xml.transform.TransformerConfigurationException: 
javax.xml.transform.TransformerConfigurationException: 
javax.xml.transform.TransformerException: 
javax.xml.transform.TransformerException: xsl:analyze-string is not 
allowed in this position in the stylesheet!
        at 
com.webdeninteractive.xbotts.client.api.server.ServerRequest.s
end(ServerRequest.java:167)
        at 
com.webdeninteractive.bie.dashboard.chaining.TestRoute.doPost(
TestRoute.java:141)
        at 
javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
        at 
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilt
er(ApplicationFilterChain.java:247)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(Appli
cationFilterChain.java:193)
        at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardW
rapperValve.java:260)
        at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValv
    
eContext.invokeNext(StandardPipeline.java:643)
  
        at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
ine.java:480)
        at 
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
        at 
org.apache.catalina.core.StandardContextValve.invoke(StandardC
ontextValve.java:191)
        at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValv
    
eContext.invokeNext(StandardPipeline.java:643)
  
        at 
org.apache.catalina.authenticator.AuthenticatorBase.invoke(Aut
henticatorBase.java:527)
        at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValv
    
eContext.invokeNext(StandardPipeline.java:641)
  
        at 
org.apache.catalina.valves.CertificatesValve.invoke(Certificat
esValve.java:246)
        at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValv
    
eContext.invokeNext(StandardPipeline.java:641)
  
        at 
com.webdeninteractive.bie.dashboard.security.HTTPBasicMappingV
alve.process(HTTPBasicMappingValve.java:196)
        at 
com.webdeninteractive.bie.dashboard.security.HTTPBasicMappingV
alve.invoke(HTTPBasicMappingValve.java:136)




-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click
_______________________________________________
saxon-help mailing list
saxon-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/saxon-help

    



-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click
_______________________________________________
saxon-help mailing list
saxon-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/saxon-help