我只能回答您关于如何从 XSLT 调用 java 函数的第一个问题。在您的样式表声明中,您必须定义一个命名空间,例如xmlns:filecounter="mappings.GenerateSequenceNumber"
:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:filecounter="mappings.GenerateSequenceNumber"
exclude-result-prefixes="filecounter" version="1.0">
<xsl:output indent="yes"/>
In this case the java function is in the package "mappings" and the java class is called "GenerateSequenceNumber".
When calling the java function in your stylesheet you do for example:
<xsl:value-of select="filecounter:getSequenceNumber('countit',3)"/>
So you call the method "getSequenceNumber" in your java class and pass any variables that the java function needs in the brackets.
Unfortunately I can't help you with your second question.