RE: Can't pass parameters across differing contexts?
"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
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format