Небольшой пример использования xsl:variable и xsl:param. Аналогичное XSLT-преобразование проверялось на C#: использовался объект XslCompiledTransform, которому передавалось значение параметра.
На входе:
<Root>
<Child>
<first>f1</first>
<second>s1</second>
</Child>
<Child>
<first>f2</first>
<second>s2</second>
</Child>
</Root>
На выходе получим:
<NewRoot>
<NewChild>
<first>paramValue</first>
<second>s1</second>
</NewChild>
<NewChild>
<first>paramValue</first>
<second>s2</second>
</NewChild>
</NewRoot>
XSLT-преобразование:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl">
<xsl:output method="xml" indent="yes"/>
<xsl:param name="myParam"></xsl:param>
<xsl:template match="/Root">
<NewRoot>
<xsl:apply-templates select="Child"/>
</NewRoot>
</xsl:template>
<xsl:template match="Child">
<xsl:variable name="myVariable">
<xsl:value-of select="second"/>
</xsl:variable>
<NewChild>
<xsl:element name="first">
<xsl:value-of select="@myParam"/>
</xsl:element>
<xsl:element name="second">
<xsl:value-of select="@myVariable"/>
</xsl:element>
</NewChild>
</xsl:template>
</xsl:stylesheet>