Examples of using both xml, schema, and xslt

Source: Internet
Author: User
Tags xmlns xslt
I have never used schema before. I hope to add namespace and schema to my xml file this time, and then convert it into html using xslt. I didn't expect to spend a lot of time. Now I will record the results of my normal work and hope to help you.
Let's first look at my xml file. The menu to be used to define the webpage.
<? Xml version = "1.0" encoding = "GB2312"?>
<Menu_items>
<Menu_item href = "index.html" image = "images/A1.gif" name = "homepage"/>
<Menu_item href = "ep.html" image = "images/A2.gif" name = "news">
<Menu_item href = "ep.html" image = "images/A2.gif" name = "Chinese news"/>
</Menu_item>
</Menu_items>
A simple xml file is used to automatically Generate a Schema file using the Generate schema function of xmlspy, and then make some minor modifications. The result is as follows:
<? Xml version = "1.0" encoding = "GB2312"?>
<Xs: schema xmlns = "http://www.hz-sp.com/2005/XMLSchema-menu" xmlns: xs = "http://www.w3.org/2001/XMLSchema" targetNamespace = "http://www.hz-sp.com/2005/XMLSchema-menu">
<Xs: element name = "menu_item">
<Xs: complexType>
<Xs: sequence>
<Xs: element ref = "menu_item" minOccurs = "0"/>
</Xs: sequence>
<Xs: attribute name = "name" type = "xs: string" use = "required"/>
<Xs: attribute name = "href" type = "xs: anyURI" use = "optional"/>
<Xs: attribute name = "image" type = "xs: anyURI" use = "optional"/>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.