[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: Joerg Pietschmann <joerg.pietschmann@xxxxxx>
Date: Mon, 29 Oct 2001 10:48:54 +0100
pass node as parameter xslt
"Hunsberger, Peter" <Peter.Hunsberger@xxxxxxxxxx> wrote:
> 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!

Adding nitpicks to what others have already said:
Assume your document is
<?xml version="1.0"?>
<?some sample pi?>
<options>
   <option>foo</option>
</options>

Note that i added a processing instruction for demonstration purposes.
The logical structure is (view with fixed font)

root node "/"
 |
 +-- PI node "some sample pi"
 |
 +-- element node "options"
     |
     +-- text node with some whitespace
     |
     +-- element node "option"
     |   |
     |   +-- text node "foo"
     |
     +-- text node with some whitespace

The topmost element node in a document, in your case the "options"
element node, is often called "document element", the term "root node"
is actually incorrect (though also often used by people not really
familiar with the standard).
The sample processing instruction was inserted to show why there
is actually a root node in the tree and why it's not the document
element node (perhaps some white space text nodes not shown above are
also present: Language lawyers attention! Should they be there?).
The document() function returns the node marked as "root node".
A root node can only be matched by the pattern "/", so you'll
have either to apply the templates to select="document(...)/options"
or define a template matching a root node with the proper mode and
passing the parameter
  <xsl:template match="/" mode="list">
     <xsl:param name="sel"/>
     <xsl:apply-templates>
      <xsl:with-param name="sel" select="$sel"/>
     </xsl:apply-templates>
  </xsl:template>

HTH
J.Pietschmann

 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.