-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support setting a Saxon initializer when invoking Calabash #335
Comments
Hi, I had shortly a similar issue. I found in Calabash the <xproc-config xmlns="http://xmlcalabash.com/ns/configuration">
<xproc-configurer class-name="full.classname.of.your.ConfigureClass"/>
</xproc-config> or by system property:
An implementation of an configurer could look like this: import com.xmlcalabash.config.JaxpConfigurer;
import com.xmlcalabash.config.JingConfigurer;
import com.xmlcalabash.config.XMLCalabashConfigurer;
import com.xmlcalabash.core.XProcRuntime;
import com.xmlcalabash.util.DefaultJaxpConfigurer;
import com.xmlcalabash.util.DefaultJingConfigurer;
import com.xmlcalabash.util.DefaultSaxonConfigurer;
import com.xmlcalabash.util.DefaultXMLCalabashConfigurer;
import net.sf.saxon.Configuration;
public class XProcConfigurer implements com.xmlcalabash.config.XProcConfigurer {
private final XProcRuntime runtime;
public XProcConfigurer(XProcRuntime runtime){
this.runtime = runtime;
}
@Override
public XMLCalabashConfigurer getXMLCalabashConfigurer() {
return new DefaultXMLCalabashConfigurer(runtime);
}
@Override
public SaxonConfigurer getSaxonConfigurer() {
return new SaxonConfigurer() ;
}
@Override
public JingConfigurer getJingConfigurer() {
return new DefaultJingConfigurer();
}
@Override
public JaxpConfigurer getJaxpConfigurer() {
return new DefaultJaxpConfigurer();
}
private class SaxonConfigurer extends DefaultSaxonConfigurer {
@Override
public void configXSLT(Configuration config) {
//do what ever you wanted to do in the Saxon initializer
}
}
} Hope it helps! |
This is probably a case where a configuration option or command line flag is justified. I'll see what I can do. |
@ndw any update on this? We are now at the point of wanting iXML support inside Saxon, i.e. CoffeeSacks etc., inside XML Calabash. Everything but the Calabash part seems to be working nicely. Thanks! |
@wendellpiez: is there a reason why you don't use an XProcConfigurer as I proposed above? On my point of view, this is not a workaround. It is just another configuration layer. You can re-use your existing Saxon initializer by just calling it by your SaxonConfigurer. That's how I did it. |
If @aj-stein-nist is promising to help with the Java aspects, I might just do this, thanks @nkutsche (and for the link as well). |
The implication of my thumbs up is be me looking into it, trying to work with it in our project, and report back here. :-) |
Beginning in Saxon 9.3 you can pass in a class that implements the interface net.sf.saxon.lib.Initializer to register extension functions. On the command line, you would use the
-init
option. It would be great if Calabash provided a way to supply an initializer for Saxon to use.The text was updated successfully, but these errors were encountered: