I have to use XSLT 1.0 with the XML below. It has a function jr:itext which I have surrogated by a user-defined function with exslt. I could strip jr:itext() and call the function explicitly as shown in the example, but it looks ugly and I have other functions in the full version.
How do I call(func-string) in XSLT`?
<?xml version="1.0"?>
<html xmlns="http://www.w3.org/2002/xforms" xmlns:jr="http://openrosa.org/javarosa">
<label ref="jr:itext('calculate_test_output')"/>
</html>
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:jr="http://openrosa.org/javarosa"
xmlns:func="http://exslt.org/functions"
extension-element-prefixes="func" >
<func:function name="jr:itext">
<xsl:param name="ref" />
<func:result select="concat('itext ', $ref)"/>
</func:function>
<xsl:template match="/">
Requested output
<xsl:value-of select="jr:itext('calculate_test_output')" />,
Using "call function from string?"
<xsl:variable name="ref" select="html/label/@ref"/>
<xsl:value-of select="$ref"/>
<!-- <xsl:execute-this-function select="$ref" />,-->
</xsl:template>
</xsl:stylesheet>
<xsl:value-of select="dyn:evaluate($ref)" xmlns:dyn="http://exslt.org/dynamic"/>. I have no idea, however, whether any processor supporting EXSLT functions and EXSLTdyn:evaluateexposes the functions declared withfunc:functionto the XPath context of thedyn:evaluatefunction.