XALAN寄存器扩展功能,如SAXON [英] XALAN register Extension Function like in SAXON
本文介绍了XALAN寄存器扩展功能,如SAXON的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想用XALAN通过XSLT转换XML。现在我想使用扩展函数,这个函数必须像在SAXON中一样添加到JAVA源中:
i want to transform a XML by XSLT with XALAN. Now i want to use a extension-function, this function have to be added in JAVA source like in SAXON:
方法:
TransformerFactory tFactory = TransformerFactory.newInstance();
Configuration c = ((net.sf.saxon.TransformerFactoryImpl) tFactory).getConfiguration();
c.registerExtensionFunction(new FooExtension());
FooExtension:
FooExtension:
public class FooExtension extends ExtensionFunctionDefinition {
private static final long serialVersionUID = -8143237239412146617L;
@Override
public SequenceType[] getArgumentTypes() {
return new SequenceType[] { SequenceType.EMPTY_SEQUENCE };
}
@Override
public StructuredQName getFunctionQName() {
return new StructuredQName("ns", "http://namespace", "generate-guid");
}
}
但它在XALAN中是如何工作的???FunctionTable? ,?FunctionResolver?,?URIResolver?),我必须按来源做,我不允许在XSLT中添加类。
But how does it works in XALAN (?FunctionTable?, ?FunctionResolver?, ?URIResolver?) , i have to do it by source, i'm not allowed to add class in XSLT.
谢谢!!
推荐答案
这里有来自Xalan项目的一些优秀文档: http://xml.apache.org/xalan-j/extensions_xsltc.html
There's some excellent documentation on this matter from the Xalan project here: http://xml.apache.org/xalan-j/extensions_xsltc.html
这篇关于XALAN寄存器扩展功能,如SAXON的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文