473,379 Members | 1,377 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Difference between xsl:param and xsl:variable?

Hi!
Can you please explain to me the difference between a xsl:param and a
xsl:variable? Since I can assign a value to both only once, what's the
point? A small example would help me a lot.

Regards,
Karsten.
--
The email above is not in use. Please write to k dot weinert at gmx
dot net.
Jul 20 '05 #1
3 11035
Karsten Weinert wrote:
Hi!
Can you please explain to me the difference between a xsl:param and a
xsl:variable? Since I can assign a value to both only once, what's the
point? A small example would help me a lot.

Regards,
Karsten.
--
The email above is not in use. Please write to k dot weinert at gmx
dot net.


Hi Karsten,
you can assign different values to xsl:param like in the following example

....
<xsl:call-template name="foo">
<xsl:with-param name="arg" select="1"/>
</xsl:call-template>
<xsl:call-template name="foo">
<xsl:with-param name="arg" select="2"/>
</xsl:call-template>
....
<xsl:template name="foo">
<xsl:param name="arg" />
...
</xsl:template>

Best regards, Stephan
Jul 20 '05 #2


Karsten Weinert wrote:

Can you please explain to me the difference between a xsl:param and a
xsl:variable? Since I can assign a value to both only once, what's the
point? A small example would help me a lot.


An XSLT processor allows (or should allow) you to pass external
parameters to a transformation for the global <xsl:param> elements you
have in your stylesheet. Check the documentation of your XSLT processor.
And if you have an <xsl:param> element in a named template you can call
that template and pass a parameter in with
<xsl:call-template name="templateName">
<xsl:with-param name="paramName" select="xpathHere" />
</xsl:call-template>
much like in other programming languages you declare a function with
formal parameters and then call it with actual parameters.

A variable is just meant to store some value.

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #3
Thanks, Martin Honnen and Stephan Dahl for the clear explanation. I
can use param to set default values for the stylesheet/named template,
which may or may not be overriden. So param is more powerful than
variable, I could use param instead of variable.

Karsten.
Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Xeon | last post by:
Hi, I'm trying this code snippet below but the parser (sablotron) returns error : <xsl:choose> <xsl:when test="some test case"> <xsl:variable name="test" select="0"/> </xsl:when>...
5
by: ipg | last post by:
I am running into issues passing a parameter (that is a XML string) into a stylesheet and using msxsl:node-set to parse the string. Can someone please explain why. my html: var xsl = new...
1
by: Tjerk Wolterink | last post by:
Xsl stylesheet can accept parameters, but can you also give an array-data-type parameter?? With xsl parameters i mean these: Well i solved my problem but these <xsl:param name="param1"/>
10
by: Tjerk Wolterink | last post by:
The following code does not work: <xsl:variable name="width" select="form:image-width"/> <xsl:if test="$width>$max_image_width"> <xsl:variable name="width" select="$max_image_width"/> </xsl:if>...
0
by: kirashet | last post by:
Hello everybody, I tried to make a XSL:FO - Sheet where I can control if the PDF should be printed in portrait or landscape. My results so far: <xsl:param name="printingtype"...
2
by: sucheta.phatak | last post by:
Hello, I am trying to use XSLT. Here is the problem that I am facing. My XML file: <Book level="1" name="Mapplicationtoc1"> ....... Some more tags </Book>
5
by: Afshar Mohebbi | last post by:
Hi everybody there, I've declared a <xsl:variable name="something" select="999"/> in my xslt and when I want to set another value in it (with same syntax) I get error the variable "something" has...
2
by: jobooker | last post by:
I'm having issues sorting. The short description is, how do I set the select attribute of xsl:sort to be the value of an xsl:variable? The longer description follows: What I want to do is to be...
0
by: Markchivs | last post by:
Hi all, I wonder if anyone can shed any light on this problem for me? In the following code I'm trying to set a variable called 'atts' with a node set of attributes which will include the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.