XML and XSLT design question
The situation is I have the .NET code which is functional, but some of the tables and stored procedures have been accidentally dropped. Weird situation - but I have to deal with it!
Here is the XSLT:
HTML Code:
<?xml version="1.0" encoding="utf-8"?>
<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="html" indent="yes"/>
<xsl:template match="Review">
<xsl:for-each select="Comment">
<div class="control-group">
<label class="control-label">
<xsl:value-of select="./@name"/>
<br/>
<xsl:value-of select="./@date"/>
</label>
<div class="controls">
<xsl:value-of select="./@Review"/>
</div>
</div>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
And here is the XML I am generating from stored proc (Which I think should work, but isn’t. I need help with this so that it ties with the xslt above)
HTML Code:
<Review>
<Comment name="Wilson, Angel" date="08/01/2013" Review="Some reviews" />
<Comment name="Wilson, Angel" date="08/05/2013" Review="additional reviews" />
</Review>
It throws error in .js file when trying to process the XML to the supplied XSLT
HTML Code:
if (window.ActiveXObject || xhttp.responseType == "msxml-document") {
ex = xml.transformNode(xsl);
$('#' + containerID).html(ex);
}
JavaScript runtime error: Object doesn't support property or method 'transformNode'.
I will appreciate if someone could help me with this.
Re: XML and XSLT design question
I have found that it is an IE11 issue. The code works in Chrome. Apparently, IE11 is not supporting transformNode it seems. Any suggestions how to fix this?
Re: XML and XSLT design question
Do you have a fiddle for this so we can test your js code?
kgc
Re: XML and XSLT design question
Quote:
Originally Posted by
KGComputers
Do you have a fiddle for this so we can test your js code?
kgc
I am not sure what you are asking. Do you mean I should use Fiddler?
From what I have found so far this code is not working on my machine but working for another developer. So it is not IE 11 issue as I said previously. But I still don't know what is it - windows or JavaScript update or some issue with my Visual Studio 2010?
Also, I have a bunch of XSLTs and I am hard time figuring out what format of XML should be returned from SQL server. I did W3Schools tutorials on XSLT but that is too basic. Do you have any recommendation?
Re: XML and XSLT design question
I mean JSFiddle (Testing JavaScript codes). I've worked before on a project using XSLT to transform xml documents as reports. Let me check in our code repository if our notes/POC's are still there.
Re: XML and XSLT design question
Quote:
Originally Posted by
KGComputers
I mean JSFiddle (Testing JavaScript codes). I've worked before on a project using XSLT to transform xml documents as reports. Let me check in our code repository if our notes/POC's are still there.
That would be a great help if you could please provide me some documentation.
Thanks
Re: XML and XSLT design question
Quote:
From what I have found so far this code is not working on my machine but working for another developer. So it is not IE 11 issue as I said previously. But I still don't know what is it - windows or JavaScript update or some issue with my Visual Studio 2010?
I tested the code from MSDN Initiate XSLT in a Script using our test machines with IE (7-10). There's no issue at all.
- kgc
Re: XML and XSLT design question
Quote:
Originally Posted by
KGComputers
This sample works for me as well. My code is in .js file and still doesn't work
Re: XML and XSLT design question
Quote:
My code is in .js file and still doesn't work
The code works in an external .js file. I just added reference in my html/aspx page the external script and called the InitXml() function in jQuery ready() function.
JavaScript Code:
<script type="text/javascript" src="Scripts/InitXml.js"></script>
<script type="text/javascript">
$(document).ready(function () {
InitXml(); //code snippet from msdn
});
</script>