EDN Admin
Well-known member
Hi folk,
I have an issue with the applying an xsl transformation to an xml in C#. The transformation is working well in IE 8.
Here is the code I have:
XslCompiledTransform transform = new XslCompiledTransform();<br/>
XsltSettings xslt_set = new XsltSettings();<br/>
xslt_set.EnableScript = true;<br/>
XmlReader myreader = XmlReader.Create(new StringReader(File.ReadAllText(<path to xsl>)));<br/>
transform.Load(myreader, xslt_set, new XmlUrlResolver());<br/>
XmlReader xr = XmlReader.Create(@"C:TE ConnectivityInboundCables170-1951-xxTDRTDR_Report[2 29 51 PM][8 16 2012].xml");<br/>
StringBuilder htmlContent = new StringBuilder();<br/>
XmlWriter result = XmlWriter.Create(htmlContent);<br/>
transform.Transform(xr, result);
and the error I get is:
{"Objects of type Script2 do not have such a member"}
that comes from this section of the xsl file:
function GraphArray(sLBound, sHBound)<br/>
{<br/>
this.LBoundElements = (sLBound.substring(1).replace(/]/g,"")).split("[");
//error comes here <br/>
this.HBoundElements = sHBound.substring(1).replace(/]/g,"").split("[");<br/>
this.Dimensions = sLBound.split("[").length - 1;<br/>
... <br/>
}
I didnt write the script and Im not very familiar with xsl, but what bugs me it that it works with IE.
I read somewhere that IE uses MSXML 3.0 to do transform, so could it be a change in MSXML 6.0 that makes that xsl not compliant anymore? if so, is there a way to make it compliant or is ther a way in C# to make the same transform as IE does?
Thanks for your help
<br/>
View the full article
I have an issue with the applying an xsl transformation to an xml in C#. The transformation is working well in IE 8.
Here is the code I have:
XslCompiledTransform transform = new XslCompiledTransform();<br/>
XsltSettings xslt_set = new XsltSettings();<br/>
xslt_set.EnableScript = true;<br/>
XmlReader myreader = XmlReader.Create(new StringReader(File.ReadAllText(<path to xsl>)));<br/>
transform.Load(myreader, xslt_set, new XmlUrlResolver());<br/>
XmlReader xr = XmlReader.Create(@"C:TE ConnectivityInboundCables170-1951-xxTDRTDR_Report[2 29 51 PM][8 16 2012].xml");<br/>
StringBuilder htmlContent = new StringBuilder();<br/>
XmlWriter result = XmlWriter.Create(htmlContent);<br/>
transform.Transform(xr, result);
and the error I get is:
{"Objects of type Script2 do not have such a member"}
that comes from this section of the xsl file:
function GraphArray(sLBound, sHBound)<br/>
{<br/>
this.LBoundElements = (sLBound.substring(1).replace(/]/g,"")).split("[");
//error comes here <br/>
this.HBoundElements = sHBound.substring(1).replace(/]/g,"").split("[");<br/>
this.Dimensions = sLBound.split("[").length - 1;<br/>
... <br/>
}
I didnt write the script and Im not very familiar with xsl, but what bugs me it that it works with IE.
I read somewhere that IE uses MSXML 3.0 to do transform, so could it be a change in MSXML 6.0 that makes that xsl not compliant anymore? if so, is there a way to make it compliant or is ther a way in C# to make the same transform as IE does?
Thanks for your help
<br/>
View the full article