|
Subject:
|
XSL - Parameter query.
|
|
Posted By:
|
Neal
|
Post Date:
|
1/24/2006 9:52:50 AM
|
Hi,
I know this may appear easy but please can someone help.
In the example below, am I right in thinking that:
1. The Parameter name is 'ToOrFrom'
2. The value to be passed is 'From'
3. The template to be called is 'DeliveryNotificationHeader'.
<!--Templates called from DeliveryNotificationHeader.xsl--> <xsl:call-template name="DeliveryNotificationHeader"> <xsl:with-param name="ToOrFrom">From</xsl:with-param> </xsl:call-template>
I have had limited experience in this field.
Many thanks,
Neal
A Northern Soul
|
|
Reply By:
|
mhkay
|
Reply Date:
|
1/24/2006 10:56:26 AM
|
Yes, almost. In fact the value of the parameter is a result-tree-fragment consisting of a document node that owns a text node whose value is "From". For most practical purposes this will behave exactly like passing the string "From", but it's a lot less efficient. It's better to pass the string itself:
<xsl:with-param name="ToOrFrom" select="'From'"/>
Note the nested quotes.
Michael Kay http://www.saxonica.com/ Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
|
|
Reply By:
|
Neal
|
Reply Date:
|
1/24/2006 11:22:50 AM
|
Excellent, very prompt.
So, are there any beneifts in the original code?
(FYI - The template is a separate XSL form)
Thanks again,
Neal
A Northern Soul
|
|
Reply By:
|
mhkay
|
Reply Date:
|
1/24/2006 12:25:58 PM
|
There are obviously cases where you do need to build a real result tree fragment (typically it will contain elements) but an RTF that only contains a single text node is always pointless.
Michael Kay http://www.saxonica.com/ Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
|
|
Reply By:
|
mhkay
|
Reply Date:
|
1/24/2006 12:27:08 PM
|
Having said that, there's one case I use them which is
<xsl:variable name="quote">"</xsl:variable>
which is purely for the convenience of not having to escape the quotes.
Michael Kay http://www.saxonica.com/ Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
|