473,397 Members | 2,028 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,397 software developers and data experts.

XSLT Parameter scoping problem using .Net and XSLTArgumentList

I am having a problem with scoping of parameters in my XSLT
Stylesheet...here is the stylesheet (the xml document is irrelevant
for the example)

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="myParam">Stylesheet Default</xsl:param>
<xsl:template match="/">
<result_explicit_call>
<xsl:call-template name="test">
<xsl:with-param name="myParam">Explicit Call</xsl:with-param>
</xsl:call-template>
</result_explicit_call>

<result_template_default>
<xsl:call-template name="test"/>
</result_template_default>

</xsl:template>

<xsl:template name="test">
<xsl:param name="myParam">Template Default</xsl:param>
<xsl:value-of select="$myParam"/>
</xsl:template>
</xsl:stylesheet>

The 'Correct' result for this transform (what MSXML4 returns) is...
<result_explicit_call>Explicit Call</result_explicit_call>
<result_template_default>Template Default</result_template_default>

However if I do it in .Net Version 1.1.4332 and pass down a new
parameter using xsltargument list ('Passed in'), it blows away all my
local scoping of the parameter...
<result_explicit_call>Passed in</result_explicit_call>
<result_template_default>Passed in</result_template_default>

Is this a known issue?? Is there a workaround??

Any help appreciated.

Michael Dausmann
Nov 11 '05 #1
1 2125
Michael wrote:
I am having a problem with scoping of parameters in my XSLT
Stylesheet...here is the stylesheet (the xml document is irrelevant
for the example)


Seems like a bug. I've simplified stylesheet to this one:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="param"/>
<xsl:template match="/">
<xsl:variable name="param" select="'Shadowing value'"/>
<xsl:value-of select="$param"/>
</xsl:template>
</xsl:stylesheet>

Here local variable "param" in the template must shadow any namesake global
variables and parameters, so the result must be "Shadowing value" anyway.

I've tested it under .NET 1.1. Results are:
1. No parameter value passed into transformation:
"Shadowing value"
2. "Passed in" parameter value passed into transformation:
"Passed in"

That's interesting to note that default parameter value doesn't affect
shadowing - it works as it should, but when passing actual parameter value it
breaks shadowing.
--
Oleg Tkachenko
http://www.tkachenko.com/blog
Multiconn Technologies, Israel

Nov 11 '05 #2

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

Similar topics

4
by: Gauthier | last post by:
Hi, I've a simple issue with the use of extension objects. I'm trying to call a text formating method from an object that I add to my arguments collection, this method take an input string and...
1
by: Sonu Kapoor | last post by:
Hi, I would like to use xpath with xslt. I know that this should be possible, but I dont get it ! Here is what I have tried so far: ==================================== my xml file:...
8
by: Eric Phetteplace | last post by:
Hello, I am moving over from using msxml2.domdocument to system.xml and system.xml.xsl. I'd like to present this to my group today, so your help is appreciated. I want to transform an XML...
4
by: schneider | last post by:
Anyone know if there is a way to dynamicly create a Xslt template/s and use them as an xml transform with-out use files for the Xslt? All the methods I see use files. I want to create a Xslt...
7
by: Harolds | last post by:
The code below worked in VS 2003 & dotnet framework 1.1 but now in VS 2005 the pmID is evaluated to "" instead of what the value is set to: .... xmlItems.Document = pmXML // Add the pmID...
1
by: cameron | last post by:
I am attempting to pass in an XmlDocument as a parameter to a transform: from my sample ASPX page: string BaseDir = "/cameron/Play/ComplexParam/"; XmlDocument XSL = new XmlDocument();...
1
by: Nick | last post by:
I am working on a website for a client and one of their requirements was to have a mailing list. I decided to XSLT to transform "templates" to HTML so that editing was very easy and less time...
4
by: =?Utf-8?B?REZC?= | last post by:
Within an XSLT transformation, I'm trying to switch the default namespace within a section of the generated XML document to a shared namespace. This way, the content of this section does not have...
10
by: bbembi_de | last post by:
Hello everyone, is it possible to give a transformation a input parameter? I want to use this parameter as a variable in my transformation. thanks. bye bembi
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.