Re: [xsl] required parameter

Subject: Re: [xsl] required parameter
From: Michael Kay <mike@xxxxxxxxxxxx>
Date: Tue, 18 Oct 2011 18:26:23 +0100
My guess would be that the mode="helper" template is being called from somewhere other than the apply-templates call you are showing us. Without a complete stylesheet, it's impossible to verify that.

Incidentally, if the input is as you show it, then the first <xsl:sequence> doesn't select anything, and neither does the select in the with-param (or rather, it selects an empty sequence, which shouldn't in itself violate the required="yes" requirement.)

Michael Kay
Saxonica

On 18/10/2011 16:17, Merrilees, David wrote:
Hi

I have an XSLT problem I don't understand. I pass a value in a parameter to a template like so:

<xsl:template match="/" as="element()">
        <div id="languageOption">
               <xsl:sequence select="model:model/model:LanguageOptions" />
               <xsl:apply-templates select="f:action-form('fLanguage', 'Set', 'Language', 'post')" mode="helper">
                      <xsl:with-param name="language-options" select="model:model/model:LanguageOptions" />
               </xsl:apply-templates>
        </div>
</xsl:template>

Which is matched by this template:

<xsl:template mode="helper" match="form[@id = 'fLanguage']">
        <xsl:param name="language-options" required="yes"/>
</xsl:template>

and I get the error: 'No value supplied for required parameter $language-options'. Problem is, if I remove the required attribute, the line '<xsl:sequence select="model:model/model:LanguageOptions" />' works fine.

Input XML looks like this:

        <model:LanguageOptions>
               <model:SelectListItem>
                      <model:Selected>false</model:Selected>
                      <model:Text>Hesky</model:Text>
                      <model:Value>cs-CZ</model:Value>
               </model:SelectListItem>
               <model:SelectListItem>
                      <model:Selected>true</model:Selected>
                      <model:Text>English</model:Text>
                      <model:Value>en-GB</model:Value>
               </model:SelectListItem>
        </model:LanguageOptions>

Any bright ideas?

Thanks

This is a confidential email. Tesco may monitor and record all emails. The views expressed in this email are those of the sender and not Tesco.

Tesco Stores Limited
Company Number: 519500
Registered in England
Registered Office: Tesco House, Delamare Road, Cheshunt, Hertfordshire EN8 9SL
VAT Registration Number: GB 220 4302 31

Current Thread