[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: R: IQuestion about XSLT and Math Operations

Subject: Re: R: IQuestion about XSLT and Math Operations
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Mon, 05 Dec 2005 08:11:12 -0500
define math
At 2005-12-05 13:09 +0100, drkm wrote:
"G. Ken Holman" wrote:
> At 2005-12-05 00:23 +0100, Villani Alessandro wrote:

> ><?xml version="1.0" encoding="utf-8"?>
> ><xsl:stylesheet
> > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> > version="1.0">
> >      <xsl:output method="xml"
> >        omit-xml-declaration="yes" indent="yes"/>
> >      <xsl:template match="parameters">
> >           <xsl:param name="r50">
> >...
> You can just do:
>    <c2><xsl:value-of select="r3 * r2"/></c2>

That's not the same things (it's an xsl:param, not an xsl:variable).

Some of my students come to class confused about this. Constructs defined by <xsl:param> and <xsl:variable> are used in *precisely* the same way once a value is bound. The sole difference between the two is how the value is bound: for a variable the value can only be the value declared, while for a parameter the value is the declared value only if it is not overridden when the template invoked with a <xsl:with-param>. Otherwise they are treated as exactly the same kind of thing.


In the author's example, the parameter is declared as a parameter of an unnamed template rule, thus the *only* way that a value other than the default value is bound to the parameter is through <xsl:with-param> as a child of <xsl:apply-templates>. Given that all of the information used is provided for in the source tree, I doubt that the template rule match was necessarily parameterized ... without more of the example code showing his use of <xsl:apply-templates> I made the assumption (and it was an assumption) that the author was using <xsl:param> unnecessarily and that <xsl:variable> was just as suitable.

Because as I said, except for how the value is bound, they are indeed the same thing when being used. There are no differences in reference and use.

I hope this is considered helpful.

. . . . . . . . . Ken


-- Upcoming XSLT/XSL-FO hands-on courses: Denver,CO March 13-17,2006 World-wide on-site corporate, govt. & user group XML/XSL training. G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995) Male Cancer Awareness Aug'05 http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.