my application has many old stylesheets written in xslt 1.0 , new ones being written in xslt 2.0.
with saxon 9.6 many of old stylesheets not functioning properly, ones using exslt set:distinct. hence, want continue using xalan transform old xslt 1.0 stylesheets, use saxon new xslt 2.0 stylesheets.
in java best way read xsl:stylesheet/@version attribute of xsl file before deciding on transformerfactory?
as of now, application creates streamsource absolute path of xsl file.
source xslsource = new streamsource(xslfilepath); string version = ...; // todo xslt version of xsl file transformerfactory transformerfactory; if ("2.0".equals(version)) { transformerfactory = new net.sf.saxon.transformerfactoryimpl(); } else { transformerfactory = new org.apache.xalan.processor.transformerfactoryimpl(); }
that's way any. note if write sax contentreader access xsl:stylesheet/@version, can abort parsing version known throwing saxexception.
Comments
Post a Comment