• <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 日需博客 閱讀(863) 評論(0)  編輯 收藏 引用 所屬分類: C#Windows技術文章轉載
            国产一级做a爰片久久毛片| 久久夜色精品国产网站| 久久精品国产亚洲精品2020| 久久精品国产亚洲av麻豆色欲| 久久综合久久综合亚洲| 色婷婷综合久久久久中文 | 人妻丰满AV无码久久不卡| 一本一道久久综合狠狠老| 精品免费tv久久久久久久| 久久伊人精品青青草原高清| 久久亚洲国产精品成人AV秋霞| 国产Av激情久久无码天堂| 中文字幕精品久久久久人妻| 午夜精品久久久久久久久| 中文国产成人精品久久亚洲精品AⅤ无码精品 | 色综合久久久久综合99| 久久婷婷国产综合精品| 久久AAAA片一区二区| 久久综合精品国产二区无码| 久久国产福利免费| 91精品国产乱码久久久久久| 狠狠色综合网站久久久久久久高清| .精品久久久麻豆国产精品| 香蕉久久夜色精品国产2020| 国内精品久久久久久久涩爱| 久久婷婷国产综合精品| 国内精品久久久久影院薰衣草 | 久久夜色精品国产噜噜噜亚洲AV| 国产精品久久久久久一区二区三区 | 成人综合伊人五月婷久久| 欧美国产成人久久精品| 天天综合久久一二三区| 久久国产精品波多野结衣AV| 久久亚洲国产欧洲精品一| 97久久久精品综合88久久| 久久丫精品国产亚洲av| 色88久久久久高潮综合影院| 日韩精品久久无码中文字幕| 一本一本久久a久久综合精品蜜桃 一本一道久久综合狠狠老 | 99久久精品费精品国产| 久久男人AV资源网站|