Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. XML / XSL
  4. XML to HTML page

XML to HTML page

Scheduled Pinned Locked Moved XML / XSL
xmlhtmlperformance
5 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    B L Praveen
    wrote on last edited by
    #1

    I trie to display a greeting Message in an html by redaing the words from xml.This was a my first simple progrma on xml.Use XMLDOM to load xml and xsl to memory.Transfomed into html. The html page dispplay only words of greeting.It doesn't display the text read from xml. This my xsl code:

     words of greeting:
    
        xsl:value-of select="greeting"   
    

    The Xml code

    Hello world.

    Praveen

    D 1 Reply Last reply
    0
    • B B L Praveen

      I trie to display a greeting Message in an html by redaing the words from xml.This was a my first simple progrma on xml.Use XMLDOM to load xml and xsl to memory.Transfomed into html. The html page dispplay only words of greeting.It doesn't display the text read from xml. This my xsl code:

       words of greeting:
      
          xsl:value-of select="greeting"   
      

      The Xml code

      Hello world.

      Praveen

      D Offline
      D Offline
      Dustin Metzgar
      wrote on last edited by
      #2

      You have to change your <'s to <'s and >'s to >'s. We can't see your XML text.

      B 1 Reply Last reply
      0
      • D Dustin Metzgar

        You have to change your <'s to <'s and >'s to >'s. We can't see your XML text.

        B Offline
        B Offline
        B L Praveen
        wrote on last edited by
        #3

        The Xsl stylesheet File used by xml to display html page

        <?xml version="1.0"?><!--hellohtm.xsl-->
        <html xmlns:xsl="http://www.w3.org/1999/xsl/transform" xsl:version="1.0">
        <head><title>Greeting</title></head>
        <body><p> words of greeting:<br/>
        <b><i><u><xsl:value-of select="greeting"/></u></i></b>
        </p>
        </body>
        </html>

        The Xml file hodliing greeting message to be printed

        <?xml version="1.0"?>
        <?xml-stylesheet type="type/xsl" href="Hello.xsl"?>
        <greeting>Hello world.</greeting>

        The Html page should display the greeting message read from the xml file:" The page displays only the word of greeting on the page it must also display the xml greeting message Hello World."

        <html>
        <body>
        <script language="javascript">
        // Load XML
        var xml = new ActiveXObject("Microsoft.XMLDOM")
        xml.async = false
        xml.load("Hello.xml")

        // Load the XSL
        var xsl = new ActiveXObject("Microsoft.XMLDOM")
        xsl.async = false
        xsl.load("Hello.xsl")

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

        </body>
        </html>

        Praveen

        D 1 Reply Last reply
        0
        • B B L Praveen

          The Xsl stylesheet File used by xml to display html page

          <?xml version="1.0"?><!--hellohtm.xsl-->
          <html xmlns:xsl="http://www.w3.org/1999/xsl/transform" xsl:version="1.0">
          <head><title>Greeting</title></head>
          <body><p> words of greeting:<br/>
          <b><i><u><xsl:value-of select="greeting"/></u></i></b>
          </p>
          </body>
          </html>

          The Xml file hodliing greeting message to be printed

          <?xml version="1.0"?>
          <?xml-stylesheet type="type/xsl" href="Hello.xsl"?>
          <greeting>Hello world.</greeting>

          The Html page should display the greeting message read from the xml file:" The page displays only the word of greeting on the page it must also display the xml greeting message Hello World."

          <html>
          <body>
          <script language="javascript">
          // Load XML
          var xml = new ActiveXObject("Microsoft.XMLDOM")
          xml.async = false
          xml.load("Hello.xml")

          // Load the XSL
          var xsl = new ActiveXObject("Microsoft.XMLDOM")
          xsl.async = false
          xsl.load("Hello.xsl")

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

          </body>
          </html>

          Praveen

          D Offline
          D Offline
          Dustin Metzgar
          wrote on last edited by
          #4

          Excellent, that helps a lot. You have to divide the XML from the XSL.  Here's what the XML should look like:

          <?xml version="1.0" encoding="utf-8"?>
          <greeting>Hello world.</greeting>

          And here's an example XSL:

          <?xml version="1.0" encoding="utf-8"?>
          <xsl:stylesheet version="1.0"
              xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
          <xsl:template match="/">
              <html>
              <body>
                <xsl:value-of select="greeting"/>
              </body>
              </html>
          </xsl:template>
          </xsl:stylesheet>

          You had the XSL tags in the XML source document.  The XML source document should be free-form, meaning that it can be pretty much anything as long as it's legal XML.  The XSL is the transform and is pretty specific to the input and output expected.  Check out zvon[^] or w3schools[^] for some tutorials on XSL.


          Logifusion[^]

          B 1 Reply Last reply
          0
          • D Dustin Metzgar

            Excellent, that helps a lot. You have to divide the XML from the XSL.  Here's what the XML should look like:

            <?xml version="1.0" encoding="utf-8"?>
            <greeting>Hello world.</greeting>

            And here's an example XSL:

            <?xml version="1.0" encoding="utf-8"?>
            <xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
            <xsl:template match="/">
                <html>
                <body>
                  <xsl:value-of select="greeting"/>
                </body>
                </html>
            </xsl:template>
            </xsl:stylesheet>

            You had the XSL tags in the XML source document.  The XML source document should be free-form, meaning that it can be pretty much anything as long as it's legal XML.  The XSL is the transform and is pretty specific to the input and output expected.  Check out zvon[^] or w3schools[^] for some tutorials on XSL.


            Logifusion[^]

            B Offline
            B Offline
            B L Praveen
            wrote on last edited by
            #5

            Thanks, it is displaying

            Praveen

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups