Friday, January 11, 2008

xsltApplyOneTemplate: problem with xsl:with-param

If you happen to be writing XSLT and are getting a strange error such as this:
xsltApplyOneTemplate: problem with xsl:with-param


But the template seems to run and produce the output, then it could be a typo problem with one of your templates. I ran into this and it took some time to actually discover the problem, (there was a lot of XSLT templates to look at):

I had created a template like this:
<xsl:template match="*[contains(@class,' map/topicref ')]" name="topicrefNestedSection" mode="nestedSection">
<xsl:with-param name="level" />


It should be changed to this:
<xsl:template match="*[contains(@class,' map/topicref ')]" name="topicrefNestedSection" mode="nestedSection">
<xsl:param name="level" />


For some reason I put an xsl:with-param instead of an xsl:param tag. This typo is, for some reason, NOT an XSLT syntax error that is caught by the processor. The only indication I found of a problem is the messages printed by the XSLT processor. Obviously the parameter passed to the template was not working when I was using xsl:with-param and began working once I fixed the typo.

No comments:

About Me

My photo
Lead Java Developer Husband and Father

Tags