[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Accessing Global Parameters from an included Stylesheet


Subject: Re: [xsl] Accessing Global Parameters from an included Stylesheet
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Mon, 19 Jan 2004 17:49:11 -0500

At 2004-01-19 12:35 +0530, S.Murali Krishna wrote:
Correct me If I'm wrong. I'm just trying to help u out.

The code fragment below is incorrect.


In the above code, the xsl:param has to be provided inside call-template
element.

Not true ... I believe Todd needs top-level <xsl:param> I'm guessing for the command line.


like following.

<xsl:call-template name="LatestNews">
 <xsl:param name="id"></xsl:param>

That isn't valid syntax ... it would have had to be <xsl:with-param> if relevant.


And the 'LatestNews' template has to be modifed as following.
<xsl:template name="LatestNews">
 <xsl:param-variable name="stateFolder">Default Value</xsl:param-variable>

That isn't valid syntax ... there is no such element <xsl:param-variable>



(looking back to Todd's post......)



At 2004-01-19 15:09 +1100, Todd Baker wrote:
I am getting some weird behaviour in the parsing of my XSLT stylesheets in
the MSXML 4(SP2) parser and would like to ask the list if its me or the
parser at fault.

It looks weird ... I see nothing wrong with your code (I *am* assuming you want those parameters passed during invocation of the stylesheet) and I get no errors when running Saxon with your supplied fragments.


As you can see I am using the $stateFolder and $stateLibraryFolder
parameters from the main stylesheet to evaluate my XPATH, the problem is,
whilst I CAN ACCESS $stateFolder I CANNOT access $stateLibraryFolder.

They are peers ... no reason I can think of why you couldn't see both.


If I then define this parameter in nswTemplates.xsl I get this error:

"Global variable or parameter 'stateLibraryFolder' cannot be defined more
than once with the same import precedence."

Which is what I was expecting...

Yes, I agree.


My question is, should I be able to access these parameters

Yes, you should.


or should I be
parsing these into each template using with-param

No, you needn't have to.


OR is this a MSXML bug?

Not sure ... I just ran your stylesheets with whatever DLL is in IE 6.0 and I did not receive any messages. I'm using the command-line environment described in the annex of our free XSLT book preview download. My copy of MSXML produces a single HTML H1 element with "Latest News" in it (I'm not sending any parameters).


I hope this helps.

........................ Ken

--
North America (Washington, DC): 3-day XSLT/2-day XSL-FO 2004-03-15
-          (San Francisco, CA): 3-day XSLT/2-day XSL-FO 2004-03-22
Asia        (Hong Kong, China): 3-day XSLT/2-day XSL-FO 2004-05-17
Europe       (Bremen, Germany): 3-day XSLT/2-day XSL-FO 2004-05-24
Instructor-led on-site corporate, government & user group training
for XSLT and XSL-FO world-wide:  please contact us for the details

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 Breast Cancer Awareness  http://www.CraneSoftwrights.com/s/bc


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list




Current Thread
Keywords