• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            流量統計:
            Rixu Blog (日需博客)
            日需博客,每日必需來踩踩哦..
            posts - 108,comments - 54,trackbacks - 0
            1.創建XSLT文件,定義格式;
            2.在C#中使用XslCompiledTransform對象的load()方法加載XSLT文件;
            3.使用Transform()方法轉換XML文檔。

            實例:將books.xml按照books.xsl定義的格式轉換成out.html
            TestXsl.cs:
            using System;
            using System.Xml.Xsl;

            namespace Magci.Test.XML.TestXsl
            {
            class Program
            {
            static void Main(string[] args)
            {
            XslCompiledTransform trans
            = new XslCompiledTransform();
            trans.Load(
            @"..\..\books.xsl");
            trans.Transform(
            @"..\..\books.xml", "out.html");
            }
            }
            }

            books.xml:

            <?xml version="1.0" encoding="utf-8" ?>
            <bookstore>
            <book genre="autobiography" publicationdate="1991" ISBN="1-861003-11-0">
            <title>The Autobiography of Benjamin Franklin</title>
            <author>
            <first-name>Benjamin</first-name>
            <last-name>Franklin</last-name>
            </author>
            <price>8.99</price>
            </book>
            <book genre="novel" publicationdate="1967" ISBN="0-201-63361-2">
            <title>The Confidence Man</title>
            <author>
            <first-name>Herman</first-name>
            <last-name>Melville</last-name>
            </author>
            <price>11.99</price>
            </book>
            <book genre="philosophy" publicationdate="1991" ISBN="1-861001-57-6">
            <title>The Gorgias</title>
            <author>
            <name>Plato</name>
            </author>
            <price>9.99</price>
            </book>
            </bookstore>

            books.xsl:

            <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
            <xsl:template match="/">
            <HTML>
            <head>
            <title>Price List</title>
            </head>
            <body>
            <table>
            <xsl:apply-templates/>
            </table>
            </body>
            </HTML>
            </xsl:template>

            <xsl:template match="bookstore">
            <xsl:apply-templates select="book"/>
            </xsl:template>

            <xsl:template match="book">
            <tr>
            <td>
            <xsl:value-of select="title"/>
            </td>
            <td>
            <xsl:value-of select="price"/>
            </td>
            </tr>
            </xsl:template>
            </xsl:stylesheet>

            out.html:

            <HTML>
            <head>
            <META http-equiv="Content-Type" content="text/html; charset=utf-8">
            <title>Price List</title>
            </head>
            <body>
            <table>
            <tr>
            <td>The Autobiography of Benjamin Franklin</td>
            <td>8.99</td>
            </tr>
            <tr>
            <td>The Confidence Man</td>
            <td>11.99</td>
            </tr>
            <tr>
            <td>The Gorgias</td>
            <td>9.99</td>
            </tr>
            </table>
            </body>
            </HTML>
            Logo
            作者:Gezidan
            出處:http://www.rixu.net    
            本文版權歸作者和博客園共有,歡迎轉載,但未經作者同意必須保留此段聲明,且在文章頁面明顯位置給出原文連接,否則保留追究法律責任的權利。
            posted on 2011-08-15 09:53 日需博客 閱讀(858) 評論(0)  編輯 收藏 引用 所屬分類: C# 、Windows 、技術文章 、轉載
            久久人人爽人人爽人人爽| 久久国产三级无码一区二区| 99久久99这里只有免费的精品| 久久美女网站免费| 热RE99久久精品国产66热| 99国产精品久久| 亚洲AV伊人久久青青草原| 久久精品中文字幕久久| 久久天天躁狠狠躁夜夜2020一| 国产精品热久久毛片| 久久久久久九九99精品| 色天使久久综合网天天| 91精品国产高清久久久久久国产嫩草 | 久久久无码精品午夜| 99国产精品久久久久久久成人热| 亚洲精品美女久久777777| 国产精品午夜久久| 国内精品人妻无码久久久影院| 久久九九久精品国产免费直播| 久久综合日本熟妇| 久久这里只有精品久久| 久久人爽人人爽人人片AV| 久久精品国产AV一区二区三区| 中文字幕久久亚洲一区| 久久亚洲2019中文字幕| 久久综合九色综合欧美就去吻| 国产综合免费精品久久久| 93精91精品国产综合久久香蕉| 情人伊人久久综合亚洲| 免费国产99久久久香蕉| 国产亚洲色婷婷久久99精品91| 国产一区二区三精品久久久无广告 | 免费国产99久久久香蕉| 欧美亚洲另类久久综合| 国产亚州精品女人久久久久久 | 久久综合丝袜日本网| 国产成人综合久久精品尤物| 国产激情久久久久影院老熟女 | 99久久国产综合精品网成人影院 | 国产99久久久国产精免费| 久久高潮一级毛片免费|