XSLT转换XML实例
转自江边孤鸟: http://blog.csdn.net/jbgh608/archive/2007/08/31/1767414.aspx
W3school 的xsl教程: http://www.w3school.com.cn/xsl/index.asp
产品几年前使用ASP,后来升级到.Net 1.1,再升级到2.0,一直都有用XSLT转换XML生成网页的方式,稍微整理下。
XML file:
<?xml version="1.0" encoding="utf-8" ?>
<ric>
<catalog>
<book price="75">
<author>Kalen Delaney</author>
<name>Inside SQL Server 2000</name>
</book>
<book price="200">
<author>Ken Henderson</author>
<name>The Guru's Guide to SQL Server Architecture</name>
</book>
</catalog>
</ric>
XSLT file:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="utf-8"/>
<xsl:template match="/">
<html>
<body>
<table cellpadding="0" cellspacing="0" border="1" style="border-collapse:collapse;font-size:14px;">
<tr>
<th>Book Name</th>
<th>Author</th>
<th>Price</th>
</tr>
&l
相关文档:
package com.kiloway.trace.utils;
import java.lang.reflect.Field;
/**
* @author Zhang Qi
* @Create Time 2010/01/09
* */
public class ObjectToXML {
public String toString(Object object) throws Exception {
StringBuilder sb = new StringBuilder();
//得到类的名称
String classname = obj ......
<?xml version="1.0" encoding="utf-8"?>
<userdata createuser="false">
<dataconnection>
<server>xml test</server>
<uid>sa</uid>
<pwd>sa</pwd>
</dataconnection> ......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Xml;
namespace WebApplication2
{
/// <summary>
/// XMLHelper XML文档操作管理器
&nb ......
XML的产生?
XML的全称是Extensible Markup Language,意思是可扩展的标记语言,它是标准通用标记语言(Standard Generalized Markup Language, SGML)的一个子集。SGML功能非常强大,是可以定义标记语言的元语言。
W3C组织于2004年2月4日,发布了XML1.1的推荐标准,这是最新的XML版本,不过目前大多数的应用还是基于XML1.0的 ......