[xsl] Urgent: Load a document in XALAN ?

Subject: [xsl] Urgent: Load a document in XALAN ?
From: Tuan-Dung Cao <Tuan-Dung.Cao@xxxxxxxxxxxxxxx>
Date: Wed, 10 Jul 2002 15:41:26 +0200
In my XSLT file to extract some information, i have to use a schema rdfs. And I
have some code :

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:rdf ="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
xmlns:xalan ="http://xml.apache.org/xalan"; exclude-result-prefixes="xalan"
xmlns:c ="http://www.inria.fr/acacia/comma#";
xmlns:rdfs="http://www.w3.org/TR/1999/PR-rdf-schema-19990303#";
xmlns:xt="http://www.jclark.com/xt";>

<xsl:output version="1.0" indent="yes" encoding="UTF-8"/>
<xsl:variable name= "schema"
select='document("http://www-sop.inria.fr/acacia/comma.rdfs";)'/>
<xsl:variable name='language' select="'en'"/>
.....................
..................

this file work fine on mode command line of Xalan J _2:
java org.apache.xalan.xslt.Process -in 0.xhtml -xsl search_ontology.xsl -out
search_ontology.rdf

but when i make transformation in a java program that use class Transform of
Xalan(in the example), it make an error:

javax.xml.transform.dom.DOMSource; Line 0; Column 0; Can not load requested
doc: javax.xml.parsers.FactoryConfigurationError:
com.sun.xml.parser.SAXParserFactoryImpl

my code is simple:
xmlDoc : file html convert to XHTML
xslDoc: is a file xsl convert to DOM Doc

public static void transformXMLXalan2(Document xmlDoc, Document xslDoc, String
fileNameOut) throws XMLHelperException {
               try {
                     TransformerFactory tFactory =
TransformerFactory.newInstance();
                     // Make the input sources for the XML and XSLT documents
                     javax.xml.transform.Source xmlSource =  new
javax.xml.transform.dom.DOMSource(xmlDoc);
                     javax.xml.transform.Source xsltSource = new
javax.xml.transform.dom.DOMSource(xslDoc);

                     // Make the output result for the finished document using

                      StreamResult xmlResult = new StreamResult(new
FileOutputStream(fileNameOut));
                      // Get a XSLT transformer
                      Transformer transformer =
tFactory.newTransformer(xsltSource);
                      //Transformer transformer = tFactory.newTransformer(new
StreamSource("1.xsl"));
                      // Do the transform
                      transformer.transform(xmlSource, xmlResult);

               }
               catch (TransformerConfigurationException e) {
   throw new XMLHelperException("Unable to perform transform", e);
               }
               catch (javax.xml.transform.TransformerException trane) {
   throw new XMLHelperException("Unable to perform transform", trane);
               }

               catch (IOException ioe) {
   throw new XMLHelperException("Unable to perform IO transform", ioe);
        }
        }

I try to debug for a week but i cant not resolve it, any one have experience in
this prob?
Help me please.
Best wishs.

CAO. Tuan DUng



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread