Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Sep 2002
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to display the same XML file with different XSLT?

    I have an XML file acting as a dictionary in a bilingual website. But for a certain XML file, you can only specify an XSLT to express it. How do I display the XML file with different XSLTs?

  • #2
    New to the CF scene
    Join Date
    Sep 2002
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Same XML file with different XSLT

    If you're using IE, you can remove the XSL reference from your XML document and use the following javascript (changing the names of the XML and XSL to your filenames).

    <script type="text/javascript">
    // Load XML
    var xml = new ActiveXObject("MSXML2.DOMDocument")
    xml.async = false
    xml.load("yourfile.xml")

    // Load the XSL
    var xsl = new ActiveXObject("MSXML2.DOMDocument")
    xsl.async = false
    xsl.load("file1.xsl")

    // Transform
    document.write(xml.transformNode(xsl))
    </script>


    To apply another stylesheet, just duplicate the code in a different document and specify a different XSL file.

    HTH--

    Kathryn
    Last edited by kathryngz; 09-11-2002 at 11:04 PM.

  • #3
    New to the CF scene
    Join Date
    Sep 2002
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up Great!

    Thanks, buddy! That's really what I want!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •