![]() |
![]() | ![]() | ![]() | Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries [Thread Prev] >Thread Next - Re: xsl:with-param fails in XSL stylesheets that accept external arguments xsl:with-param fails in XSL stylesheets that accept external argumentsTo: NULL Date: 11/3/2006 10:16:00 AM
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).
What am I doing wrong?
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
| ![]() | ![]() | ![]() |
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | |||||
|
