472,333 Members | 1,159 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,333 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 10981
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">...
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...
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...
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...
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:...
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...
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...
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...
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...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...

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.