XsltArgumentList.AddParam is often demonstrated like this:
xslArg = new XsltArgumentList();
xslArg.AddParam("param-name", string.Empty, "param-value");
Does anyone have an example of an XSL where it is relevant to specify anything other than an empty string as the namespaceUri (the second argument)?
The namespaceUri argument is described like this in the documentation: "The namespace URI to associate with the parameter. To use the default namespace, specify an empty string."
That parameter is just for namespacing your own parameters. For example, you might define an xslt like this:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns="urn:my-output-namespace"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:input="urn:my-input-variables"
version="1.0" >
<xsl:param name="input:myVariable" />
...
</xsl:stylesheet>
In code, in order to pass the parameter for myVariable
, you have to add the namespace URI to the XsltArgumentList.AddParam
call.
var args = new XsltArgumentList();
args.AddParam("myVariable", "urn:my-input-variables", "foo");