-
Aug 10th, 2016, 03:16 PM
#1
Thread Starter
Hyperactive Member
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.
-
Aug 11th, 2016, 07:50 AM
#2
Thread Starter
Hyperactive Member
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?
-
Aug 16th, 2016, 12:04 AM
#3
Re: XML and XSLT design question
Do you have a fiddle for this so we can test your js code?
kgc
-
Aug 16th, 2016, 08:21 AM
#4
Thread Starter
Hyperactive Member
Re: XML and XSLT design question
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?
-
Aug 16th, 2016, 09:10 AM
#5
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.
-
Aug 16th, 2016, 09:21 AM
#6
Thread Starter
Hyperactive Member
Re: XML and XSLT design question
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
-
Aug 16th, 2016, 10:41 AM
#7
Re: XML and XSLT design question
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
Last edited by KGComputers; Aug 16th, 2016 at 11:08 AM.
Reason: added IE versions
-
Aug 16th, 2016, 12:32 PM
#8
Thread Starter
Hyperactive Member
Re: XML and XSLT design question
Originally Posted by KGComputers
This sample works for me as well. My code is in .js file and still doesn't work
-
Aug 16th, 2016, 11:00 PM
#9
Re: XML and XSLT design question
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>
Last edited by KGComputers; Aug 17th, 2016 at 12:08 AM.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|