XSLT / XML / C# (转)
这个例程展示了如何将xslt 应用于从数据库中读出的xml格式数据上. 例程完全使用C#语言编写:
using System;
using System.Collections;
using System.Data;
using System.Data.SqlClient;
using System.Xml;
using System.Xml.Xsl;
public class XsltTransform
{
public static void Transform()
{
SqlConnection nwindConn = new SqlConnection("Data
Source=INMUMIS123;database=northwind;uid=sa;pwd=;");
nwindConn.Open();
DataSet custDS = new DataSet("CustomerDataSet");
SqlDataAdapter custDA = new SqlDataAdapter("SELECT * FROM Customers",
nwindConn);
custDA.Fill(custDS, "Customers");
SqlDataAdapter ordersDA = new SqlDataAdapter("SELECT * FROM Orders",
nwindConn);
ordersDA.Fill(custDS, "Orders");
nwindConn.Close();
custDS.Relations.Add("CustOrders",
custDS.Tables["Customers"].Columns["CustomerID"],