Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 24th, 2006, 10:52 AM
Friend of Wrox
Points: 696, Level: 9
Points: 696, Level: 9 Points: 696, Level: 9 Points: 696, Level: 9
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2006
Location: Ennis, Clare, Ireland.
Posts: 129
Thanks: 10
Thanked 0 Times in 0 Posts
Default XSL - Parameter query.

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'.


<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
__________________
Neal

A Northern Soul
Reply With Quote
  #2 (permalink)  
Old January 24th, 2006, 11:56 AM
mhkay's Avatar
Wrox Author
Points: 18,481, Level: 59
Points: 18,481, Level: 59 Points: 18,481, Level: 59 Points: 18,481, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,960
Thanks: 0
Thanked 292 Times in 287 Posts
Default

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 With Quote
  #3 (permalink)  
Old January 24th, 2006, 12:22 PM
Friend of Wrox
Points: 696, Level: 9
Points: 696, Level: 9 Points: 696, Level: 9 Points: 696, Level: 9
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2006
Location: Ennis, Clare, Ireland.
Posts: 129
Thanks: 10
Thanked 0 Times in 0 Posts
Default

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 With Quote
  #4 (permalink)  
Old January 24th, 2006, 01:25 PM
mhkay's Avatar
Wrox Author
Points: 18,481, Level: 59
Points: 18,481, Level: 59 Points: 18,481, Level: 59 Points: 18,481, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,960
Thanks: 0
Thanked 292 Times in 287 Posts
Default

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 With Quote
  #5 (permalink)  
Old January 24th, 2006, 01:27 PM
mhkay's Avatar
Wrox Author
Points: 18,481, Level: 59
Points: 18,481, Level: 59 Points: 18,481, Level: 59 Points: 18,481, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,960
Thanks: 0
Thanked 292 Times in 287 Posts
Default

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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pass link values as xsl:parameter to php5 then xsl pauljr8 XSLT 1 July 2nd, 2007 10:32 PM
How to increment/decrement a parameter in XSL tclotworthy XSLT 2 February 9th, 2007 04:24 PM
XSL Variable and/or Parameter Question ripple XSLT 9 September 1st, 2006 12:16 PM
USING PARAMETER INSIDE XSL:TEXT cleytonjordan XSLT 6 July 29th, 2005 07:30 PM
XSL Parameter xsl:param Harinath Chikoti XSLT 1 May 6th, 2005 03:15 AM



All times are GMT -4. The time now is 04:26 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.