[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Can't pass parameters across differing contexts?

Subject: RE: Can't pass parameters across differing contexts?
From: "Hunsberger, Peter" <Peter.Hunsberger@xxxxxxxxxx>
Date: Fri, 26 Oct 2001 08:54:55 -0500
peter hunsberger
Ahh, that almost makes sense.  The only reason I'm not completely convinced
is since the root node in the referenced document is in fact the one named
"options" in the original example?  However, if defining a root rule that
passes on the parameter doesn't work you can be sure I'll post here!

-----Original Message-----
From: Joerg Pietschmann [mailto:joerg.pietschmann@xxxxxx]
Sent: Friday, October 26, 2001 2:46 AM
To: XSL List
Subject: Re:  Can't pass parameters across differing contexts?


"Hunsberger, Peter" <Peter.Hunsberger@xxxxxxxxxx> 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

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.