You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Malia Zaheer <mz...@technicacorp.com> on 2002/03/21 18:56:14 UTC
error using xsl:param
I get an error that says:
file:///D:/Temp/xsd2mdl.xsl; Line 83; Column 24; XSLT Error
(javax.xml.transform.TransformerConfigur
ationException): javax.xml.transform.TransformerException:
javax.xml.transform.TransformerException:
xsl:param is not allowed in this position in the stylesheet!
when I try to use xsl:param in xsl:otherwise element. Here is my xsl:
<xsl:template match="element">
<xsl:choose><xsl:when test="count(@ref) > 0"> <!-- element
reference -->
<xsl:call-template name="meaningOf"><xsl:with-param name="_name"
select="@ref"/><xsl:with-param name="_option"
select="@minOccurs"/></xsl:call-template>
<xsl:variable name="ref" select="@ref"/>
<xsl:apply-templates select="/schema/element[@name=$ref]">
<xsl:with-param name="_id" select="@_id"/>
<xsl:with-param name="minOccurs" select="@minOccurs"/>
<xsl:with-param name="maxOccurs" select="@maxOccurs"/>
</xsl:apply-templates>
</xsl:when><xsl:otherwise> <!-- element
definition -->
<xsl:param name="_id"/> <!-- I GET AN ERROR AT THIS POINT -->
<xsl:param name="minOccurs"/>
<xsl:param name="maxOccurs"/>
<xsl:variable name="_minOccurs">
<xsl:choose><xsl:when test="$minOccurs != ''"><xsl:value-of
select="$minOccurs"/>
</xsl:when><xsl:otherwise><xsl:value-of select="@minOccurs"/>
</xsl:otherwise></xsl:choose>
</xsl:variable>
<xsl:call-template name="meaningOf"><xsl:with-param name="_name"
select="@name"/><xsl:with-param name="_option"
select="$_minOccurs"/></xsl:call-template>
<xsl:element name="element">
<xsl:choose><xsl:when test="$_id != ''">
<xsl:attribute name="_id"><xsl:value-of select="$_id"/></xsl:attribute>
<xsl:attribute name="_defId"><xsl:value-of select="@_id"/></xsl:attribute>
</xsl:when><xsl:otherwise>
<xsl:copy-of select="@_id"/>
</xsl:otherwise></xsl:choose>
<xsl:copy-of select="@name"/>
<xsl:if test="$_minOccurs != ''"><xsl:attribute
name="minOccurs"><xsl:value-of
select="$_minOccurs"/></xsl:attribute></xsl:if>
<xsl:if test="$maxOccurs != '' or @maxOccurs != ''">
<xsl:attribute name="maxOccurs">
<xsl:choose><xsl:when test="$maxOccurs != ''"><xsl:value-of
select="$maxOccurs"/>
</xsl:when><xsl:otherwise><xsl:value-of select="@maxOccurs"/>
</xsl:otherwise></xsl:choose>
</xsl:attribute>
</xsl:if>
</xsl:element>
</xsl:otherwise></xsl:choose>
</xsl:template>
Is this a bug? Any help appreciated.
Thanks,
Malia