Hi,
sorry if this is cross post.. I have a simple XSLTransformation which I am
trying to load it in XSLTransform class as indicated below
loading xsl :
XslTransform tran = new XslTransform();
tran.Load(@"C:\AV\DotNet Projects\ReplaceString.xsl");
but the problem is its always giving the following errors when I load..
1. '' is an invalid QName - I have kind of resolved this by using { } for
accessing params.
2. boolean(contains({$str},{$from}) is an invalid XPath expression. - i am
not sure why this is an invalid xpath.
please do help.
ReplaceString.xsl :
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:call-template name="replace-string">
<xsl:with-param name="str" select="Str"></xsl:with-param>
<xsl:with-param name="from" select="From"></xsl:with-param>
<xsl:with-param name="to" select="To"></xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template name="replace-string">
<xsl:param name="str"/>
<xsl:param name="from"/>
<xsl:param name="to"/>
<xsl:if test="contains({$str},{$from})">
<xsl:call-template name="">
<xsl:with-param name="str" select="substring-before({$str},{$from})"/>
<xsl:with-param name="from" select="substring-after({$str},{$from})"/>
<xsl:with-param name="to" select="$to"/>
</xsl:call-template>
</xsl:if>
<xsl:value-of select="concat({$str},{$to})"/>
</xsl:template>
</xsl:stylesheet>
thank you,
Av.