Project

Profile

Help

Run XSLT 1.0 and 2.0 side by side

Added by Anonymous almost 16 years ago

Legacy ID: #5380949 Legacy Poster: Jim R (su27k)

Hi, We have a requirement to use XSLT 1.0 on some transformations, and XSLT 2.0 on others, any idea on what's the best way to handle this? It looks to me JAXP doesn't allow the choice of implementation when creating transformers, and Saxon 9 doesn't support XSLT 1.0, so I'm guessing the only way to do this is: 1. Use system property javax.xml.parsers.DocumentBuilderFactory to set a XSLT 1.0 implementation for JAXP 2. Write a custom class which can switch between XSLT 1.0 and 2.0, for 1.0 use JAXP, for 2.0 use Saxon's s9api Is this the only way? Thanks.


Replies (2)

RE: Run XSLT 1.0 and 2.0 side by side - Added by Anonymous almost 16 years ago

Legacy ID: #5381858 Legacy Poster: Michael Kay (mhkay)

I would run all the transformations using Saxon 9. When a stylesheet specifies version="1.0", it's very unlikely that there will be any incompatibilities when you run it under an XSLT 2.0 processor. The only exception might be if your stylesheet has heavy dependencies on things that were always processor-specific, for example collating sequences or extension functions. But you should be able to run Saxon 9 alongside an XSLT 1.0 processor if that's what you really want to do (either Xalan or Saxon 6, you don't actually say which you want to use). Remember that you don't have to use the (expensive and fragile) JAXP mechanism for locating a TransformerFactory - you can instantiate the TransformerFactory you want explicitly, for example to get the Saxon-B 9 implementation use new net.sf.saxon.TransformerFactoryImpl();

RE: Run XSLT 1.0 and 2.0 side by side - Added by Anonymous almost 16 years ago

Legacy ID: #5383432 Legacy Poster: Jim R (su27k)

Hi, Thanks for the explanation, I don't think our stylesheets have processor specific dependencies, although I'm not the one who wrote them. The reason I want to use a XSLT 1.0 processor is because the W3C specs says there're some compatibility issues between 2.0 and 1.0 in J.1 Incompatible Changes. BTW, do you know if Saxon 9 can run on Java 1.4? I think the document says yes, but it seems the latest jar is compiled by 1.5 and cannot run from 1.4. Thanks

    (1-2/2)

    Please register to reply