xml - XSLT Calling mydefined function from another xslt -
in code below, want define function in 1 xsl file , include in xsl , call it. trying return boolean. started xslt. working code or sample appreciated.
the code below throws error:
error: 'the first argument non-static java function 'notmissingandnull' not valid object reference.' fatal error: 'the first argument non-static java function 'notmissingandnull' not valid object reference.'
first xslt: commonfunctions.xsl
<?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns:xs="http://www.w3.org/2001/xmlschema" xmlns:func="func:func" > <xsl:function name="func:notmissingandnull" as="xs:boolean"> <xsl:param name="missing" as="xs:string"/> <xsl:param name="after" as="xs:string"/> <xsl:if test="$missing.length>0 , $after.length>0"> <xsl:value-of select="true" /> </xsl:if> </xsl:function> </xsl:stylesheet>
another xslt: functions getting called
<?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns:xs="http://www.w3.org/2001/xmlschema" xmlns:func="func:func" > <xsl:import href="commonfunctions.xsl"/> <xsl:output method="xml" encoding="utf-8" indent="no"/> <xsl:template match="/"> <xsl:if test="@name = 'ac_name'"> <accountname xpath="account/{{accountid}}/accountname" maprules=""> <xsl:value-of select="func:notmissingandnull('missing','after')" /> </accountname> </xsl:if> </xsl:template> </xsl:stylesheet>
Comments
Post a Comment