Bug 7848

Summary: <x:param> causes TransformerConfigurationException
Product: Taglibs Reporter: Xiaotan(Helen) He <xiaotan.he>
Component: Standard TaglibAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED INVALID    
Severity: normal    
Priority: P3    
Version: 1.0B1   
Target Milestone: ---   
Hardware: All   
OS: All   

Description Xiaotan(Helen) He 2002-04-08 19:05:10 UTC
Here is the way I pass the parameter in the JSP file:

 <c:import url="test.xsl" var="xsl"/>
 <x:transform xmlText="${xml}" xsltText="${xsl}">
 <x:param name="cls" value="newstyle"/>
  </x:transform>

Here is what I put in the test.xsl file:

<table border="1" class="{$cls}">

 However, in the browser, it throws the following exceptions:

  javax.servlet.jsp.JspTagException:
  javax.xml.transform.TransformerConfigurationException:
  javax.xml.transform.TransformerConfigurationException:
  javax.xml.transform.TransformerException:
  org.apache.xml.utils.WrappedRuntimeException: Could not find variable with the 
name of cls
Comment 1 Shawn Bayern 2002-04-08 19:22:20 UTC
Hi Helen.

Sorry, I meant to get back to you personally on this over the weekend.  I took 
a look at the XSLT file sent, and the problem is actually with the stylesheet.  
In XSLT, you need to declare a parameter before using it.  That is, if your 
stylesheet began like this, the problem should go away:

  <?xml version="1.0"?>
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                  version="1.0">
  <xsl:param name="cls" select="default" />
  <xsl:template match="/">

  <table border="1" class="{$cls}">

The <xsl:param> element is the important one; it declares a parameter and 
specifies a default binding (which is used if no <x:param> tag defines a value 
for the name).  If you'd like more information, feel free to ask me, or read 
Section 11 of the XSLT spec (http://www.w3.org/TR/xslt#variables).

Hope that helps,

Shawn