• <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>
            流量統(tǒng)計(jì):
            Rixu Blog (日需博客)
            日需博客,每日必需來(lái)踩踩哦..
            posts - 108,comments - 54,trackbacks - 0
            1.創(chuàng)建XSLT文件,定義格式;
            2.在C#中使用XslCompiledTransform對(duì)象的load()方法加載XSLT文件;
            3.使用Transform()方法轉(zhuǎn)換XML文檔。

            實(shí)例:將books.xml按照books.xsl定義的格式轉(zhuǎn)換成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    
            本文版權(quán)歸作者和博客園共有,歡迎轉(zhuǎn)載,但未經(jīng)作者同意必須保留此段聲明,且在文章頁(yè)面明顯位置給出原文連接,否則保留追究法律責(zé)任的權(quán)利。
            posted on 2011-08-15 09:53 日需博客 閱讀(864) 評(píng)論(0)  編輯 收藏 引用 所屬分類(lèi): C#Windows技術(shù)文章轉(zhuǎn)載
            久久精品国产亚洲av影院| 国产精品成人久久久| 性欧美丰满熟妇XXXX性久久久| 伊人丁香狠狠色综合久久| 一本久久a久久精品亚洲| 午夜精品久久久内射近拍高清| 亚洲伊人久久大香线蕉苏妲己| 99国产欧美久久久精品蜜芽| 婷婷综合久久中文字幕蜜桃三电影| 亚洲精品久久久www| 亚洲精品午夜国产va久久| 亚洲国产成人久久笫一页| 亚洲精品NV久久久久久久久久| 久久激情亚洲精品无码?V| 狠狠人妻久久久久久综合| 成人精品一区二区久久| 亚洲国产精品婷婷久久| AAA级久久久精品无码区| 久久久久国产视频电影| 久久天天躁狠狠躁夜夜不卡| 日本久久中文字幕| 久久亚洲日韩看片无码| 久久综合久久自在自线精品自| 99国产欧美精品久久久蜜芽| 久久国产高潮流白浆免费观看| 99国产精品久久| 精品国产婷婷久久久| 中文成人无码精品久久久不卡 | 日韩精品无码久久一区二区三| 人妻无码精品久久亚瑟影视| 久久久久久免费视频| 午夜天堂av天堂久久久| 2021久久国自产拍精品| 国产巨作麻豆欧美亚洲综合久久| 久久综合亚洲色HEZYO国产| 久久99精品久久久大学生| AV狠狠色丁香婷婷综合久久| 精品久久久久久国产免费了| 偷窥少妇久久久久久久久| 国产成人综合久久综合| 亚洲国产综合久久天堂|