Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


xsl:with-param fails in XSL stylesheets that accept external arguments

From: "Andy" <anedza@------------------.--->
To: 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



transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent