I need validate some fields in xsl by calling non-static method of java class Validator.
I want to create object of this class and pass it to xsl. After that – i want to check if errors found.
If i make methods of class Valifator static – all works fine.
OR:
If i create object of class Validator in xsl – all works fine too.
But how work with non-static methods?
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
xmlns:validatorns="xalan://project.xmlxsl.xml.Validator"
extension-element-prefixes="validatorns">
<xsl:output method="xml" indent="yes"/>
<xsl:param name="name" />
<xsl:param name="validator" />
<xsl:variable name="checkName" select="validatorns:checkName($validator,$name)" />
...
<xsl:choose>
<xsl:when test="$checkName">
...
</xsl:when>
</xsl:choose>
</xsl:stylesheet>
Having a value returned from the XSLT other than the transformed documents sounds a little weird for my taste. But I guess you could use
ThreadLocal.