How to Embed HTML in XML Using XSL to Extract

XML files let you lay out HTML data using XML tags that you can call from an XSL file. XSL is a stylesheet for an XML file. These three coding languages come together to lay out and display information on a Web page or in a custom application you set up in an internal, corporate environment. You add the HTML content using different XML tags and reference these tags in your XSL file.

Instructions

    • 1

      Right-click the XML file you want to use to store the HTML content. Click "Open With" and select an XML editor. You can also use Windows Notepad.

    • 2

      Add the HTML content in the "HTMLData" tag. For instance, the following code creates the HTML body and content within the body:

      <HTMLDATA>
      <!--
      <BODY bgcolor=black><p>This is my content</p></body>
      -->
      </HTMLDATA>

      You can create any HTML structure you want within the "HTMLData" tags. Save the changes when you finish adding the HTML.

    • 3

      Right-click the XSL file and select "Open With." Click your preferred editor in the list of programs to open the XSL styles.

    • 4

      Add the XSL tags that display your XML file's HTML content. The following code displays the "HTMLData" tag that contains the content for your page:

      <xsl:template match="/">
      <xsl:value-of select="MYDATA/HTMLDATA"/>
      </xsl:template>

Related Searches:

References

Comments

Related Ads

Featured