T
terry.jeske
Hello,
In xalan 2.41 we were able to conditionally call a template. This
appears broken in 2.6. I did glance at the call-template specfications
but did not see anything that would point to this being a feature or a
change to follow a standard. The problem is that if the called
template is not included in xslt pass, I get:
javax.xml.transform.TransformerException: ElemTemplateElement error:
"your missing template name here".
We are upgrading our app to java 1.5, and have made extensive use of
this type of call which allow us to have leverage common code for
presentation and admin pages. Below is a simplified code snipet. If it
runs for you, make sure you check your xalan version by running java
org.apache.xalan.Version.
Any insight into why this is happening would be most appreciated.
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/1999/xhtml">
<xslutput method="xml"
media-type="text/html"
doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
doctype-system="DTD/xhtml1-strict.dtd"
encoding="ISO-8859-1" />
<xsl:variable name="testCall" select="'false'"/>
<xsl:template match="/">
<html>
<head>
<title>Conditional call-template test</title>
</head>
<body>
<xsl:if test="$testCall = 'true'">
<xsl:call-template name="foobar"/>
</xsl:if>
No errors. Go home and relax
</body>
</html>
</xsl:template>
<!-- uncomment this and it will work -->
<!--xsl:template name="foobar">
<b>hi</b>
</xsl:template-->
</xsl:stylesheet>
In xalan 2.41 we were able to conditionally call a template. This
appears broken in 2.6. I did glance at the call-template specfications
but did not see anything that would point to this being a feature or a
change to follow a standard. The problem is that if the called
template is not included in xslt pass, I get:
javax.xml.transform.TransformerException: ElemTemplateElement error:
"your missing template name here".
We are upgrading our app to java 1.5, and have made extensive use of
this type of call which allow us to have leverage common code for
presentation and admin pages. Below is a simplified code snipet. If it
runs for you, make sure you check your xalan version by running java
org.apache.xalan.Version.
Any insight into why this is happening would be most appreciated.
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/1999/xhtml">
<xslutput method="xml"
media-type="text/html"
doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
doctype-system="DTD/xhtml1-strict.dtd"
encoding="ISO-8859-1" />
<xsl:variable name="testCall" select="'false'"/>
<xsl:template match="/">
<html>
<head>
<title>Conditional call-template test</title>
</head>
<body>
<xsl:if test="$testCall = 'true'">
<xsl:call-template name="foobar"/>
</xsl:if>
No errors. Go home and relax
</body>
</html>
</xsl:template>
<!-- uncomment this and it will work -->
<!--xsl:template name="foobar">
<b>hi</b>
</xsl:template-->
</xsl:stylesheet>