• <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 日需博客 閱讀(867) 評論(0)  編輯 收藏 引用 所屬分類: C#Windows技術文章轉載
            99精品国产免费久久久久久下载| 久久久久久久亚洲Av无码| 色成年激情久久综合| 久久精品综合一区二区三区| 久久WWW免费人成—看片| 久久精品人人做人人爽电影| 7777久久亚洲中文字幕| 国内精品久久久久久久久电影网| 漂亮人妻被中出中文字幕久久| 久久久久人妻精品一区二区三区| 久久国产乱子伦精品免费午夜| 少妇久久久久久被弄高潮| 国产精品久久国产精麻豆99网站| 亚洲精品无码专区久久同性男| 国产午夜免费高清久久影院| 久久亚洲AV无码西西人体| 亚洲αv久久久噜噜噜噜噜| 国产亚州精品女人久久久久久| 久久久久亚洲Av无码专| 日本久久久久久久久久| 久久国产精品久久国产精品| 久久人人爽人人人人爽AV | 国产aⅴ激情无码久久| 日本福利片国产午夜久久| 亚洲国产另类久久久精品| 欧洲国产伦久久久久久久| 999久久久国产精品| 99精品国产在热久久无毒不卡| 久久棈精品久久久久久噜噜| 中文字幕久久精品 | 狠狠色伊人久久精品综合网| 国产精品中文久久久久久久| 日韩亚洲国产综合久久久| 久久性精品| 国产亚洲美女精品久久久| 精品久久久久久无码中文字幕| 久久久久亚洲AV成人网| 国产精品免费久久| 久久精品国产精品亚洲艾草网美妙| 久久精品这里只有精99品| 久久久久香蕉视频|