Attributes2 is a compatible extension of Attributes, so Saxon won't have any problems if it is used. It's the default on JDK 1.5, so Saxon is using it most of the time. In fact, Saxon uses reflection to test whether the supplied Attributes value is an instance of Attributes2, and takes advantage of it if it is.
If the input to Saxon is supplied as a URI, filename, or stream, then Saxon by default uses a SAX parser to parse the input data. The SAX parser that it uses is the one determined by the -x option on the command line, or the equivalent in the Java API; or if that's not supplied, it uses the JAXP SAXParserFactory. But it can also use DOM or StAX (or JDOM or XOM or DOM4J) if that's what you supply.
Michael Kay

From: [] On Behalf Of Kermit Tensmeyer
Sent: 25 January 2008 16:43
To: Mailing list for SAXON XSLT queries
Subject: Re: [saxon] Attribute2 Error

thank you for the quick reply,
 is it safe to assume, that a choice of sax2 implementation won't conflict with saxon? I didn't see anything in the api that implemented the Attributes2, but there could be interactions between sax processing and saxon processing, that I do not yet understand. If i were writing java code, I could provide an Attributes2Impl code. Or define a property to point to a specific implementation in the cli invocation.

with that in mind, I will use one of the other suggested solutions to supply this class

What does Saxon use for xml processing (dom, sax)  with net.sf.saxon.Transform? [sax1, sax2, jdom?]

On Jan 25, 2008 5:18 AM, Michael Kay <> wrote:
This is really a Xerces question rather than a Saxon question. I think the dependency on Attributes2 comes from Xerces, not from Saxon. I don't actually know whether Xerces 2.9.1 is supported on JDK 1.4.
I downloaded 2.9.1 and took a look at it; I would have expected SAX2 to be present in the xml-apis.jar file, but it seems that contains SAX1. You may be able to make it work with SAX2 downloaded directly from SourceForge, but I can't vouch for it. Unless anyone else here knows the answer, please ask on a Xerces forum.
Michael Kay

From: [] On Behalf Of Kermit Tensmeyer
Sent: 25 January 2008 01:59
To: saxon-help ML
Subject: [saxon] Attribute2 Error

I'm trying to get XSL V2  and xinclude working.
 [The short term project is to generate SUSE autoyast xml files using XSL. The method in current process uses sed, awk,and
multiple files concatenated with some  xmllintprocessing and a lot of messy file edits and tweaks.
I've argued that XSL is a far better method of XML file generation for a  while.] [it's a put up or shut up challenge...]

  I've used emacs and nxml to get most of the stuff inplace properly
 and tested with Oxygen running under Windows to generate mostly correct output.

and now run on Linux with

ibmkt@lxwkbc194:~/yast> java -version
   java version "1.4.2"
   Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2)
   Classic VM (build 1.4.2, J2RE 1.4.2 IBM build cxz641420-20040626 (JIT
   enabled: jitc))

 where the   OS is   SLES9 on Z/OS mainframe.
    upgrading the java version or the OS is not an option (otherwise the OS is
    not a consideration)

I'd like to start with the same files (xml, xsl, xsd) in a linux environment
using Saxon 9b in a cli environment. Earlier today I had problems making xinclude work
properly, (it complained about the SAX processor) I think I understand the issues but it's taken time

In order to get xinclude working, I brought in Xerces 2.9.1 files and created
an /usr/lib/java/jre/lib/endorsed directory and added the files.

I'm using a shortcut shell script ~/bin/saxonj

java -cp  "/home/ibmkt/saxon/saxon9.jar:$CLASSPATH"  \
org.apache.xerces.jaxp.DocumentBuilderFactoryImpl \
org.apache.xerces.jaxp.SAXParserFactoryImpl  \
org.apache.xerces.parsers.XIncludeParserConfiguration \
 net.sf.saxon.Transform "$@"

and when I execute on command line

> saxonj -xsl:tmplate.xsl -o:out1.xml -xi:on     ktest.xml

  I get
Exception in thread "main" java.lang.NoClassDefFoundError: org/xml/sax/ext/Attributes2
        at org.apache.xerces.parsers.AbstractSAXParser.<init>(Unknown Source)
        at org.apache.xerces.parsers.SAXParser.<init>(Unknown Source)
        at org.apache.xerces.parsers.SAXParser.<init>(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.<init>(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserImpl.<init>(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserFactoryImpl.newSAXParser (Unknown Source)
        at net.sf.saxon.Configuration.loadParser(
        at net.sf.saxon.Configuration.getStyleParser(
        at net.sf.saxon.PreparedStylesheet.loadStylesheetModule (
        at net.sf.saxon.PreparedStylesheet.prepare(
        at net.sf.saxon.TransformerFactoryImpl.newTemplates(
        at net.sf.saxon.Transform.doTransform(
        at net.sf.saxon.Transform.main(
     what other jars do I need to supply that will satisfy the Attributes2 class?

This email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
saxon-help mailing list