Skip to content

clarification needed about xsl:template's xsl:param specifying required="no" #83

@mukulga

Description

@mukulga

I've been trying to understand xsl:template's xsl:param child element, and wrote following XSLT 3.0 stylesheet,

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs"
version="3.0">

<xsl:output method="xml" indent="yes"/>

<xsl:template match="/">
  <result>
	 <xsl:call-template name="test1">
	    <xsl:with-param name="p1" select="1"/>
	 </xsl:call-template>
  </result>
</xsl:template>

<xsl:template name="test1" as="xs:integer">
   <xsl:param name="p1" required="no" as="xs:integer"/>
   <xsl:sequence select="$p1 + 2"/>
</xsl:template>

</xsl:stylesheet>

Saxon-HE 12.5 produces no error with this stylesheet and emits following XSL stylesheet transformation result:

<?xml version="1.0" encoding="UTF-8"?> <result>3</result>

Is this not wrong?

<xsl:template name="test1" ... specifies <xsl:param name="p1" required="no", and therefore to my opinion
an error for the supplied template argument (using, <xsl:with-param name="p1" select="1"/>) must be emitted.

W3C's XSLT 3.0 test suite has a test case variable-0107 within decl\variable that uses the syntax <xsl:param name="p" required="no" ..., that made me create this issue on this XSLT 3.0 discussion forum.

Any clarification shall be helpful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions