Using Custom Parser With XSLT Processors

In order to do XSLT processing with schema PSVI information (in particular, attribute defaults), I have created a little SAX parser factory for Xerces that turns on all the schema stuff. I can then use this with, for example, Saxon, to do schema-aware XSLT (for example, DITA-aware processing that depends on the class= attribute). I'm trying to figure out how to integrate this parser with Oxygen so that I can run my transforms from within Oxygen. I tried adding the necessary JVM arg to the oxygen INI file adding the library with the parser factory class to the classpath, but it didn't seem to do anything--I suspect that the XSLT process needs it's own JVM args spec, but the only thing I saw as a place to specify a transformer factory (I can do if I have to but then I'm looked into a specific version of Saxon, for example). Have I missed something or am I going about this the wrong way? Thanks, Eliot -- W. Eliot Kimber Professional Services Innodata Isogen 8500 N. Mopac, Suite 402 Austin, TX 78759 (214) 954-5198 ekimber@innodata-isogen.com www.innodata-isogen.com package com.innodata.xerces; import javax.xml.parsers.ParserConfigurationException; import org.apache.xerces.jaxp.SAXParserFactoryImpl; import org.xml.sax.SAXNotRecognizedException; import org.xml.sax.SAXNotSupportedException; public class ValidatingSAXParserFactory extends SAXParserFactoryImpl { public ValidatingSAXParserFactory() throws SAXNotRecognizedException, SAXNotSupportedException, ParserConfigurationException { this.setFeature("http://xml.org/sax/features/validation", true); this.setFeature("http://apache.org/xml/features/validation/dynamic", true); this.setFeature("http://apache.org/xml/features/validation/schema", true); this.setFeature("http://apache.org/xml/features/validation/schema/normalized-value", true); this.setFeature("http://xml.org/sax/features/namespace-prefixes", true); } }

Hi Eliot, oXygen uses Xerces to parse the source documents for transformations and it creates explicitly the parser setting its configuration options from the oXygen options, for instance if XInclude is enabled or not. We may consider adding some more features to configure for Xerces in the oXygen options (see Options->Preferences -- XML -- XML Parser). Please let us know what features you need. Currently what you can do is to configure a custom engine (Options->Preferences -- XML -- XSLT-FO-XQuery -- Custom Engines) that invokes Saxon using a command line, and you can pass system properties to that java runtime to configure what sax parser to use and use that custom engine in your scenarios. Best Regards, George --------------------------------------------------------------------- George Cristian Bina <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger http://www.oxygenxml.com W. Eliot Kimber wrote:
In order to do XSLT processing with schema PSVI information (in particular, attribute defaults), I have created a little SAX parser factory for Xerces that turns on all the schema stuff. I can then use this with, for example, Saxon, to do schema-aware XSLT (for example, DITA-aware processing that depends on the class= attribute).
I'm trying to figure out how to integrate this parser with Oxygen so that I can run my transforms from within Oxygen.
I tried adding the necessary JVM arg to the oxygen INI file adding the library with the parser factory class to the classpath, but it didn't seem to do anything--I suspect that the XSLT process needs it's own JVM args spec, but the only thing I saw as a place to specify a transformer factory (I can do if I have to but then I'm looked into a specific version of Saxon, for example).
Have I missed something or am I going about this the wrong way?
Thanks,
Eliot
------------------------------------------------------------------------
package com.innodata.xerces;
import javax.xml.parsers.ParserConfigurationException;
import org.apache.xerces.jaxp.SAXParserFactoryImpl; import org.xml.sax.SAXNotRecognizedException; import org.xml.sax.SAXNotSupportedException;
public class ValidatingSAXParserFactory extends SAXParserFactoryImpl {
public ValidatingSAXParserFactory() throws SAXNotRecognizedException, SAXNotSupportedException, ParserConfigurationException { this.setFeature("http://xml.org/sax/features/validation", true); this.setFeature("http://apache.org/xml/features/validation/dynamic", true); this.setFeature("http://apache.org/xml/features/validation/schema", true); this.setFeature("http://apache.org/xml/features/validation/schema/normalized-value", true); this.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
}
}
------------------------------------------------------------------------
_______________________________________________ oXygen-user mailing list oXygen-user@oxygenxml.com http://www.oxygenxml.com/mailman/listinfo/oxygen-user

George Cristian Bina wrote:
Hi Eliot,
oXygen uses Xerces to parse the source documents for transformations and it creates explicitly the parser setting its configuration options from the oXygen options, for instance if XInclude is enabled or not. We may consider adding some more features to configure for Xerces in the oXygen options (see Options->Preferences -- XML -- XML Parser). Please let us know what features you need.
I think that what I would need would be the "normalized value" setting, as indicated in my little Java class. If my memory is correct, this is what causes Xerces to report the values of defaulted attributes. The ability is particularly important with DITA because all the DITA processing is done against the values of the class= attribute, which is always defaulted and shouldn't be made explicit in instances. Cheers, E. -- W. Eliot Kimber Professional Services Innodata Isogen 8500 N. Mopac, Suite 402 Austin, TX 78759 (214) 954-5198 ekimber@innodata-isogen.com www.innodata-isogen.com
participants (2)
-
George Cristian Bina
-
W. Eliot Kimber