Hi,
I have an application which works fine on my development machine. However, when I used my build on the production machine, I get an Exception.
I use code like this to transform a XML string "Text" to its transformed version:
XmlDocument oXML =
new XmlDocument();System.IO.StringWriter sw = null;
oXML.LoadXml(Text);
XslTransform xslt = new XslTransform();
sw = new System.IO.StringWriter();
xslt.Load(XSLT);
xslt.Transform(oXML, null, sw);
return sw.ToString();
With the same input string and stylesheet, on my machine, it works fine and on the prodcution machine, it generates an exception.
Here is the part of the xslt file that causes the error:
<
xsl:template name="reverse-conso-entry-amounts"><xsl:param name="entry"/>
<xsl:element name="t:entry">
<xsl:for-each select="$entry/@*">
<xsl:variable name="att-name" select="name()"/>
<xsl:variable name="att-value" select="."/>
<xsl:choose>
<xsl:when test="($att-name='ConsolidatedAmount'
or $att-name='BudgetedConsolidatedAmount'
or $att-name='ActualConsolidatedAmount'
or $att-name='ForecastedConsolidatedAmount'
or $att-name='LastForecastedConsolidatedAmount')">
<xsl:attribute name="{$att-name}">
Problem here=> <xsl:value-of select="-($att-value)"/>
</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="{$att-name}">
<xsl:value-of select="$att-value"/>
</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
<xsl:for-each select="$entry/t:entry">
<xsl:call-template name="reverse-conso-entry-amounts">
<xsl:with-param name="entry" select="."/>
</xsl:call-template>
</xsl:for-each>
</xsl:element>
</xsl:template>
Essentially, this reverts some of the attributes the input element.
Commenting the whole "<xsl:choose>" block removes the Exception problem and the Exception says there is a problem at the "<" character.
Any reasons why this would work on my machine and not on the server (different dlls maybe ) Any hints
Any help would be appreciated.
Thanks

XslTransform.Transform(): Different results on different machines?
Daniel Hern&#225;n Pallarez
Thank you for your interest. I'm sorry, I have to admit I may have left some important details.
The Exception is an "System.Xml.Xsl.XsltCompileException" and the message looks something like this "file:///c:/inetpub/wwwroot/ifinance/styles/xsltAppliedTemplates.xslt(X,Y)" where X and Y indicate the position in the xslt that causes the problem (as indicated in my first post, its at the "<".
Ben Luna
That's weird. I can't reproduce it with neither .NET 1.1 nor .NET 2.0. Chances are you've got different .NET framework with a bug in XSLT processor installed on that machine - either .NET 1.1 with no SP2, or some beta .NET 2.0. Install the latest .NET release.
Also you can try to remove () around $attr-value, -($foo) is the same as -$foo.
Amnesiasoft
What's the exception you are talking about
Erwin De Leon