xsl-list
[Top] [All Lists]

Evaluate xsl:param in Xalan extension element

2002-11-26 09:42:44
I have an extension element written for xalan which takes a parameter which
specifies the name of a template to execute. It is really a dynamic
call-template. I am trying to port the extension element from xalan v1.2 to
v2.3.1. The problem I am having is that I can't figure out how to get the
value of a parameter that was passed to the containing template. 
Example:

<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
    xmlns:dynamicTemplate="org.apache.xalan.xslt.DynamicTemplate"
    extension-element-prefixes="dynamicTemplate">

    <xsl:template match="/">
        <xsl:call-template name="DocletContentBody">
            <xsl:with-param name="docletTemplate">test</xsl:with-param>
        </xsl:call-template>
    </xsl:template>

    <xsl:template name="DocletContentBody">
        <xsl:param name="docletTemplate"/>

        <dynamicTemplate:dynamicCallTemplate name="docletTemplate">
            <xsl:call-template name="doesntMatter">
            </xsl:call-template>
        </dynamicTemplate:dynamicCallTemplate>
    </xsl:template>

    <xsl:template name="test">
    </xsl:template>
</xsl:stylesheet>

The Extension element is called dynamicTemplate. When called, it attempts to
evaluate the value of the docletTemplate param. This specifies the name of
the template to execute. 

My xalan 1.2 version achieved this by simply 
String strTemplateName = xslprocessorcontext.processor.getVariable(new
QName(strName)).str();

But in the 2.3.1, it seems that parameters are somehow lazily evaluated and
using getParam() or getVariableOrParam() always returns null?

Any help would be greatly appreciated.

Paul.

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>
  • Evaluate xsl:param in Xalan extension element, Paul Brady <=