This Season
 

How to Write a Web Page Using XML

The key to creating a Web page using XML is to understand that XML elements must be converted into HTML in order view your XML as a Web page. That's where the XSL transformation (XSLT) language comes in. XSLT lets you place instructions in a style sheet that reads your XML elements, formats them and outputs your elements in HTML. This process is called transformation.

The precise steps will depend upon the development tools you use, and how your transformation will be deployed. Typically, transformations of this type are executed on a Web server. However, it is possible to perform a transformation directly in an XML-enabled browser, such as Firefox or Internet Explorer.

Related Searches:
    Difficulty:
    Moderately Challenging

    Instructions

    Things You'll Need

    • XML document
    • XSL style sheet
    • XML-enabled Web browser
    1. Creating a Web Page Using XML

      • 1

        Create a "well-formed" XML document containing elements.

      • 2

        Place the following instruction directly below your <?xml version=""?> declaration.
        <?xml-stylesheet type="text/xsl" href="my_xslt_file.xsl"?>

      • 3

        Save your document and give it a .xml file extension.

      • 4

        Create a standard XSL style sheet.

      • 5

        In the style sheet, set the output method to "HTML" as follows:
        <xsl:output method="html" />

      • 6

        Create a template that matches an element in your XML, then select its value as follows:
        <xsl:template match="item">
        <xsl:value-of select="item"/>

      • 7

        Add HTML directly to the template to further format your Web page. For example, placing a <br /> element in the template will insert a line break in the final Web page.

      • 8

        Insert the closing tag for your XSL template as follows:
        </xsl:template>

      • 9

        Save the file as my_xslt_file.xsl

      • 10

        Point your XML-enabled browser to the XML file you created. The browser will transform the document using the style sheet and display the resulting Web page in your browser window

    Tips & Warnings

    • Click on "View Source" in your browser to view the HTML that was generated.

    • If you encounter errors, check the syntax of both your XML and XSL files.

    • Be sure to use an XML-enabled browser such as Firefox, Opera, or Internet Explorer (6.0 or later)

    • You can apply style sheets programatically. The method used to apply your style sheet depends on the programming language (Java, C#, perl) you are using.

    • Server technologies such as Java Server Pages (JSP) and Active Server Pages (ASP)may also affect the method for applying a style sheet programatically.

    Related Searches

    References

    Resources

    Read Next:

    Comments

    You May Also Like

    • How to Write a Good Profile Web Page

      A profile or "About Me/Us" page is an important part of your blog or professional website. It allows the reader to get...

    • How to Write a Haiku

      Haiku is a form of Japanese poetry that combine three different lines and a noticeable grammatical break. The break, or kireji, is...

    • How to Create a Web Page Using XML

      XML, which stands for Extensible Markup Language, is the international standard (ISO) for data representation on the web. The primary difference between...

    • How to Make a Web Page With XML

      Utilizing XML to create a web page allows developers to frequently supply fresh content for the site without having to spend time...

    • How to Create XML Document Using JDOM

      JDOM is an open source implementation of an XML document manipulation library for the Java programming language. JDOM is bundled with most...

    • XML to PDF Conversion

      When working on the Internet, whether you are a blog writer, a web designer or even a programmer, the time will eventually...

    • XML to HTML Conversion

      XML is a flexible programming language that easily translates to a variety of applications and environments. Because XML is primarily a method...

    • How to Use an Xml HTTP Object

      XmlHTTP is a DOM object (Document Object Model) provided by Microsoft's ASP infrastructure. It gives developers a way to request data and...

    • Microsoft Expression Web 2 Features

      Microsoft Expression Web 2 Features. Microsoft Expression Web is a dynamic WYSIWYG (What You See is What You Get) website design program....

    Follow eHow

    Related Ads