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

xsl:with-param fails in XSL that accepts arguments from XML control

Hi, why does with-param fail to send parameters to any templates in a
stylesheet that also accepts arguments from the ASP.NET XML control?

The argument from the XML control seems to be available to any template
in the stylesheet, even if a parameter for the argument is NOT coded
for a template call.

On the other hand, any parameters coded for a template call don't seem
to pass their values (the stylesheet doesn't crash - everything is
still rendered).
ASP.NET C# code that loads the xml control

xmlCtrl.TransformSource="template.xsl";
XsltArgumentList args1 = new XsltArgumentList();
args1.AddParam("listtype","","1");
xmlCtrl.TransformArgumentList=args1;
xmlCtrl.Document=xml;
where xml is:
<root>
<listitem TYPE='1'>A1</listitem>
<listitem TYPE='1'>A2</listitem>
<listitem TYPE='2'>B1</listitem>
<listitem TYPE='2'>B2</listitem>
<listitem TYPE='3'>C1</listitem>
<listitem TYPE='3'>C2</listitem>
</root>

and template.xsl is:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:param name="listtype"/>
<xsl:template match="/root">

<SELECT>
<xsl:apply-templates select="//listitem[@TYPE=$listtype]">
<xsl:with-param name="anyvalue" select="string('A')"/>
</xsl:apply-templates>
</SELECT>
</xsl:template>

<xsl:template name="list" match="listitem">
<xsl:param name="anyvalue" />
<OPTION>
(<xsl:value-of select="$anyvalue"/>)
<xsl:value-of select="current()" disable-output-escaping="yes"/>
</OPTION>
</xsl:template>

</xsl:stylesheet>

produces a select list with entries
()A1
()A2

when it should produce a select list with entries
(A)A1
(A)A2

Nov 3 '06 #1
1 1334

It turns out that parameters are passed as empty strings if your
apply-template's select clause doesn't select any nodes in the XML
document.

If you find yourself in this situation, its probably because you
selected a parent node that has child nodes. To remedy this, try
adding a "/*" to the end of your select and the parameters should begin
working again.

Nov 3 '06 #2

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

Similar topics

1
by: dentaku | last post by:
I use Apache FOP to create PDF files out of XSL + XML input files. The XSL file can contain SVG-images via --- <fo:block> <fo:instream-foreign-object> <svg:svg width="70mm" height="52.5mm"...
6
by: oooooo0000000 | last post by:
I have an XML file of varying nesting depth... <catalouge> <item id="1"> <name/> <item id="23"> <name/> <item id="55"> <name/> </item>
3
by: PatrickRThomas | last post by:
his question has probably been asked a million times, but I can't get this to work. I'm trying to create a global variable that contains some HTML so that I can reference it from multiple...
3
by: Ofay | last post by:
I am trying to do a mouseover with tooltips with an XSL stylesheet. I want to be able to pick data from the XML using the syntax <xsl:value-of select="CHALLENGE_REMARKS"/> How do I send the data...
1
by: gadi | last post by:
Hi. i need help. i can`t use xsl to transform an xml to html using asp.net. when the xml and the xsl are in english it works fine. the problem began when the xml ans xsl have words in...
1
by: bcochofel | last post by:
Hi, I want to update part of a XML output (generated by Perl CGI). I'm using XSL to transform the XML. Can I use this approach? I need to resort the contents of a table, that gives me the...
4
by: Christofer Dutz | last post by:
Hi, I am having a small problem, that is driving me nuts. My application reads some Xml and runs 2 Xsl Transformations to generate HTML. As soon as my second XSL introduces some <br/tags, the...
3
by: confused | last post by:
Bear with me on this its a bit long. I have some xml with a section like <product> <name>a great product</name> </product> I use javascript to parse this with an xsl template and place the...
1
by: reblace | last post by:
I'm trying to translate the following: <?xml version="1.0" encoding="UTF-8"?> <users_getInfo_response xmlns="http://api.facebook.com/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"...
1
by: sudhaMurugesan | last post by:
Hi all, I 've created an xsl file to create an excel Workbook with multiple worksheets, thro' xslt. My code works fine for sheet1. Sheet2 was created but has no data. So please help me to fill...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
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,...

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.