Skip to main content

xsl 2.0 with jaxp

5 replies [Last post]
zuper
Offline
Joined: 2008-05-24

Hi

Could anyone post a simple java code that applies a xsl 2.0 trasform using Saxon9b processor? i have some problems with settings the attribute method='2.0' on the stylesheet root element.

I hope that JAXP could do this

Thanks and sorry for my english

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
bassspieler
Offline
Joined: 2008-05-29

Well for now I did this:

//activate in JAXP: Saxon9 (standard-transformer of JAXP is Xalan)
System.setProperty("Djavax.xml.transform.TransformerFactory","net.sf.saxon.TransformerFactoryImpl");

//activate in JAXP: XPath2.0 from Saxon9 (standard XPath of JAXP is XPath1.0)
System.setProperty("Djavax.xml.xpath.XPathFactory","net.sf.saxon.xpath.XPathFactoryImpl");

With this lines:

//test XSL-Transformer
TransformerFactory instance = TransformerFactory.newInstance();
System.out.println("\n>>>activ XSLT-Transformer: " + instance.getClass().getName());

you can test, whether Saxon9 is integrated in JAXP. But I didn't perform a transformation, yet.

Does this help you?
Bye,
Martin

bassspieler
Offline
Joined: 2008-05-29

Hi,

I'm working exactly at the same topic. But I'm at the beginning, too. My additional question is, how to ensure, that JAXP uses Saxon9b for transforming. I just found the advice to set the parameters for the JVM. But I need a solution to integrate it via code, because it's a team-project and Saxon9b should always be the one and only transformer. And my stylesheets are XSLT2.0.

So, is anyone out there, who already did all this?
Thank you,
Martin

joehw
Offline
Joined: 2004-12-15

Doesn't the Saxon Documentation at http://www.saxonica.com/documentation/index/intro.html provide enough information for you to get it work properly? You may also want to ask Saxonica for help.

zuper
Offline
Joined: 2008-05-24

i can transform using s9api libraries of saxon but with jaxp i can trasnform only with xslt version 1.0, it's strange that nobody can resolve this issue, ok i will try to ask directly to saxon community

thanks anyway

joehw
Offline
Joined: 2004-12-15

Sorry, maybe I wasn't clear. I meant that the doc I linked contained enough information to me to enable Saxon on top of the JDK.