用XSLT文件在浏览器格式化显示XML文件

本文介绍了如何使用XMLSpy编辑工具创建XML Schema文件和XSLT文件,然后通过在XML文件中引用XSLT来实现浏览器中格式化显示XML内容。示例包括了一个描述Component信息的XML Schema文件、XML实例文件和XSLT转换文件,展示了一种将XML数据转化为易于阅读格式的方法。
摘要由CSDN通过智能技术生成

XMLSpy编辑XSDDTDXMLXSLT文件非常方便,altova公司还提供了Home Edition免费版提供下载。

首先定义一个描述ComponentXML Schema文件

<?xml version="1.0" encoding="UTF-8" ?>

<!-- edited with XMLSpy v2005 rel. 3 U (http://www.altova.com) by ibm (ibm) -->

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:col="http://www.novacolimas.com/colimas/namespace"

       targetNamespace="http://www.novacolimas.com/colimas/namespace" elementFormDefault="qualified"

       attributeFormDefault="unqualified">

       <xs:element name="ComponentsBasicInfo">

              <xs:annotation>

                     <xs:documentation>Title: cbi.xsd

 

Subject: the component basic information.

                     Publisher: Nova Corporation, Colimas.

Format: text/xml

 

Creator: Zhao Lei

                    

Date.Created: 2005-04-23

                    

Language: en-US

                    

Description:

                    

Change Log:

Version       Date                     Modifier Description

 

01.00  2005/04/25        Zhao Lei        Initial release.                                                                        

                     </xs:documentation>

              </xs:annotation>

              <xs:complexType>

                     <xs:sequence>

                           <xs:element name="ComponentBasicInfo" minOccurs="0" maxOccurs="unbounded">

                                  <xs:complexType>

                                         <xs:sequence>

                                                <xs:element name="SerialNo">

                                                       <xs:annotation>

                                                              <xs:documentation>Component SerialNo, 27 characters with a-z or A-Z or 0-9</xs:documentation>

                                                       </xs:annotation>

                                                       <xs:simpleType>

                                                              <xs:restriction base="xs:string">

                                                                     <xs:pattern value="[a-zA-Z0-9]{27}" />

                                                              </xs:restriction>

                                                       </xs:simpleType>

                                                </xs:element>

                                                <xs:element name="Name" type="xs:string">

                                                       <xs:annotation>

                                                              <xs:documentation>Component Name</xs:documentation>

                                                       </xs:annotation>

                                                </xs:element>

                                                <xs:element name="Alias" type="xs:string">

                                                       <xs:annotation>

                                                              <xs:documentation>Component Alias</xs:documentation>

                                                       </xs:annotation>

                                                </xs:element>

                                                <xs:element name="Version" default="1.0">

                                                       <xs:annotation>

                                                              <xs:documentation>Component Version</xs:documentation>

                                                       </xs:annotation>

                                                </xs:element>

                                                <xs:element name="DevelopmentLanguage" type="xs:string">

                                                       <xs:annotation>

                                                              <xs:documentation>Component Development Language</xs:documentation>

                                                       </xs:annotation>

                                                </xs:element>

                                                <xs:element name="DevelopmentPlatform" type="xs:string" />

                                                <xs:element name="Authors" type="xs:string" />

                                                <xs:element name="Status" default="Unconfirmed">

                                                       <xs:annotation>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值