I have a XSLT. which calls a function that returns a string. Like this:
<xsl:param name="mystr" select="myStrfunc()"></xsl:param>
it also calls a XML template like so:
<li>
<xsl:call-template name="myLinks">
<xsl:with-param name="link" select="$links/link[@Id='link1']" />
<xsl:with-param name="mystr"/>
</li>
the xml template snippet looks like this:
<link Id="link1">
<a href="" text="click" />
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
how can I access the parameter mystr declared in xslt here??
</link>
how can I access parameter mystr in the xml file?
This is malformed XML — the element
xsl:call-templateisn’t closed.Most probably you wanted:
This invokes the template named
"myLinks"and passes to it two parameters, named:"link"and"mystr".However, there is no value (in a
selectattribute or in the body of the element) defined for the"mystr"parameter.If you want to provide a value for the parameter — for example the result of executing a function, this can be done as follows:
Then in the body of the called template, the value of the parameter can be accessed simply by referencing it:
Or, if you need to use
$mystrto generate the value of thehrefattribute, then do: