This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Can't pass parameters across differing contexts?
- To: xsl-list at lists dot mulberrytech dot com
- Subject: Re: [xsl] Can't pass parameters across differing contexts?
- From: Jörg Heinicke <Joerg dot Heinicke at gmx dot de>
- Date: Fri, 26 Oct 2001 11:21:03 +0200 (MEST)
- References: <3BD914C7.D4119277@zkb.ch>
- Reply-To: xsl-list at lists dot mulberrytech dot com
This was my first idea too ... the built-in templates. But are there
built-in templates for modes, in this case mode="list"? If not, the template
match="options" mode="list" would not be used anytime. And I think he would have
noticed this.
Or am I wrong?
Joerg
> "Hunsberger, Peter" <Peter.Hunsberger@stjude.org> wrote:
> > I've got an XSLT template producing HTML using a series of templates
> that
> > look like the following:
> [rearranged]
> > The hard coded display of the parameter value in
> > the "options" template shows no value being passed to the template
>
> That's because it got lost. It's a common trap related to
> built-in templates and mentioned in the FAQ. More details:
>
> > <xsl:template match="list/*">
> [...]
> > <xsl:apply-templates select="document(...)" mode="list">
> > <xsl:with-param name="sel" select="'X'"/>
> > </xsl:apply-templates>
>
> This statement tells the processor to apply templates to
> the root node of the document loaded. Since you probably
> dont have a template defined for root nodes with mode "list"
> it applies the built-in template, which discards the parameter
> without notice.
>
> > <xsl:template match="options" mode="list">
> > <xsl:param name="sel"/>
> [...]
>
> Since this template is probably invoked from a built-in template,
> the parameter is unassigned.
>
> Try either to select the nodes you are interested in directly
> in the apply-templates:
>
> <xsl:apply-templates select="document(...)//options" mode="list">
> <xsl:with-param name="sel" select="'X'"/>
> </xsl:apply-templates>
>
> or override some default templates to pass the parameter (code
> omitted).
> See the spec at http://www.w3.org/TR/xslt#built-in-rule
>
> HTH
> J.Pietschmann
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>
--
GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list