1
私はSaxon-B 9.1.0.8とXSL 2.0を使用しています。Saxon-B処理XSLにパラメータを渡すにはどうすればよいですか?
私はxsl:param
要素が存在する、XSLスタイルシートを持っている:
<xsl:param name="lang"/>
そして私は私の文書の変換を行うには、次のコードを使用しています:
try {
Source xmlSource = new StreamSource(new File(xmlFilename));
Source xsltSource = new StreamSource(new File(xslFilename));
// create the transformer
Processor processor = new Processor(false);
XsltCompiler xsltCompiler = processor.newXsltCompiler();
XsltExecutable xslt = xsltCompiler.compile(xsltSource);
XsltTransformer xsltTransformer = xslt.load();
xsltTransformer.setSource(xmlSource);
// configure output
StringWriter sw = new StringWriter();
Serializer serializer = new Serializer();
serializer.setOutputWriter(sw);
serializer.setOutputProperty(Serializer.Property.INDENT, "yes");
xsltTransformer.setDestination(serializer);
// do it!
xsltTransformer.transform();
} catch (SaxonApiException e) {
logger.error(e.getMessage(), e);
}
をどのようにすべきこのパラメータの値は変圧器に渡されますか?