Subject: Re: Use of Parameters ...Help! :) From: Mike Brown <mike@xxxxxxxx> Date: Wed, 16 Aug 2000 21:09:08 -0600 (MDT) |
Perl progrmamer? :) In XSLT, a variable is just a name that is bound to an object of one of the principal types in the XPath/XSLT data model: string, number, boolean, node-set, or result tree fragment (a special kind of node-set) A parameter is just a variable that can obtain its value from outside the stylesheet, or if being set in a named template, from the xsl:call-template that led to it. It also has the ability to have a default value, if none was passed in. > <xsl:param name="myParm" select="'myCookie'"/> $myParm could be an object of any type. You have to check your XSLT processor's documentation to see how it goes about converting what you give it to one of the principal data types. You're also saying here that if it's not passed in, it will default to a string, 'myCookie'. > <xsl:for-each select="//agency//"> Not sure what you're trying to select, there, with those trailing slashes. > <xsl:sort order="ascending" select="$myParm"/> This is fine because xsl:sort expects the select attribute to be an expression, which it will convert to a string, no matter what type of object the expression evaluates to. > <xsl:apply-templates select="$myParm"/> This is dangerous because xsl:apply-templates expects the select attribute to be an expression that resolves to nothing other than a node-set. Nothing can be converted to a node-set. It has to *be* a node-set. > <xsl:template match="$myParm"> This won't work at all because xsl:template expects the match attribute to be a pattern that a given node can be tested against. $myParm is an expression, not a pattern. (I hope I'm right on this) ... It is possible to do something like match="*[name()=$myParm]", though. - Mike ____________________________________________________________________ Mike J. Brown, software engineer at My XML/XSL resources: webb.net in Denver, Colorado, USA http://www.skew.org/xml/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Use of Parameters ...Help! :), Bill Shaw - EBCX | Thread | Re: Use of Parameters ...Help! :), Mike Brown |
Subtracting in XSL?, Ramon Mariano | Date | Re: Subtracting in XSL?, Mike Brown |
Month |