Results 1 to 9 of 9

Thread: XML and XSLT design question

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2002
    Posts
    320

    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.

  2. #2

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2002
    Posts
    320

    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?

  3. #3
    Frenzied Member KGComputers's Avatar
    Join Date
    Dec 2005
    Location
    Cebu, PH
    Posts
    2,020

    Re: XML and XSLT design question

    Do you have a fiddle for this so we can test your js code?

    kgc
    CodeBank: VB.NET & C#.NET | ASP.NET
    Programming: C# | VB.NET
    Blogs: Personal | Programming
    Projects: GitHub | jsFiddle
    ___________________________________________________________________________________

    Rating someone's post is a way of saying Thanks...

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2002
    Posts
    320

    Re: XML and XSLT design question

    Quote Originally Posted by KGComputers View Post
    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?

  5. #5
    Frenzied Member KGComputers's Avatar
    Join Date
    Dec 2005
    Location
    Cebu, PH
    Posts
    2,020

    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.
    CodeBank: VB.NET & C#.NET | ASP.NET
    Programming: C# | VB.NET
    Blogs: Personal | Programming
    Projects: GitHub | jsFiddle
    ___________________________________________________________________________________

    Rating someone's post is a way of saying Thanks...

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2002
    Posts
    320

    Re: XML and XSLT design question

    Quote Originally Posted by KGComputers View Post
    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

  7. #7
    Frenzied Member KGComputers's Avatar
    Join Date
    Dec 2005
    Location
    Cebu, PH
    Posts
    2,020

    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
    CodeBank: VB.NET & C#.NET | ASP.NET
    Programming: C# | VB.NET
    Blogs: Personal | Programming
    Projects: GitHub | jsFiddle
    ___________________________________________________________________________________

    Rating someone's post is a way of saying Thanks...

  8. #8

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2002
    Posts
    320

    Re: XML and XSLT design question

    Quote Originally Posted by KGComputers View Post
    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
    This sample works for me as well. My code is in .js file and still doesn't work

  9. #9
    Frenzied Member KGComputers's Avatar
    Join Date
    Dec 2005
    Location
    Cebu, PH
    Posts
    2,020

    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:
    1. <script type="text/javascript" src="Scripts/InitXml.js"></script>
    2. <script type="text/javascript">
    3.         $(document).ready(function () {
    4.             InitXml(); //code snippet from msdn
    5.         });
    6. </script>
    Last edited by KGComputers; Aug 17th, 2016 at 12:08 AM.
    CodeBank: VB.NET & C#.NET | ASP.NET
    Programming: C# | VB.NET
    Blogs: Personal | Programming
    Projects: GitHub | jsFiddle
    ___________________________________________________________________________________

    Rating someone's post is a way of saying Thanks...

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
  •  



Click Here to Expand Forum to Full Width