• <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技術文章轉載
            色婷婷综合久久久久中文字幕| 久久人人爽人人爽人人片av高请| 狠狠色噜噜狠狠狠狠狠色综合久久| 天天躁日日躁狠狠久久| 精品国产VA久久久久久久冰 | 欧美与黑人午夜性猛交久久久| 国产精品青草久久久久福利99| 国产一区二区精品久久凹凸 | 国产精品美女久久久久| 久久精品国产亚洲沈樵| 色欲综合久久躁天天躁| 亚洲熟妇无码另类久久久| 久久天堂电影网| 中文无码久久精品| 精品国产婷婷久久久| 久久精品国产99久久无毒不卡| 久久国产热这里只有精品| 青青草原精品99久久精品66| 青青青国产精品国产精品久久久久 | 亚洲AV日韩精品久久久久久久| 久久最近最新中文字幕大全| 久久精品青青草原伊人| 久久久精品久久久久久| 久久午夜电影网| 97超级碰碰碰久久久久| 亚洲香蕉网久久综合影视 | 久久精品不卡| 久久99精品国产| 久久久久无码精品国产| 久久久国产打桩机| 婷婷久久综合九色综合绿巨人 | 久久婷婷人人澡人人爽人人爱| 久久精品成人免费看| 久久无码人妻一区二区三区| 思思久久99热只有频精品66| 伊人久久综在合线亚洲2019| 精品久久久久久无码专区不卡| 色欲久久久天天天综合网| 日韩精品久久久久久久电影| 久久久久久久国产免费看| 国产精品成人99久久久久 |