枫叶交流论坛 » 站长交流 » XSLT2.0应用实践


2007-5-21 18:36 admin
XSLT2.0应用实践



        作者: ,  出处:CNET中国, 责任编辑: 叶江, <div class="posted">2007-05-15 19:50</div>

    </div>

   



   

<div class="content">

    <h5>  这篇文章将向您介绍如何使用这些软件来应用XSLT2.0……</h5>

  <div id="pip">

   

  </div>

<div class="guanggao"><span id="contentAdv"></span></div><P>  现在,XSLT 2.0已经不再只是一个理论上的标准了,有很多免费软件都可以帮助您发挥出XSLT 2.0的力量,借助这些软件您可以在软件开发中应用XSLT 2.0。</P>

<P>  几周以前,我收到一位朋友的来信,提到了几年前我开发的软件,在这个软件中我使用了XSL样式表,我以前曾经写过文章讲解样式表的使用方法。现在,我的这位朋友将要利用XSLT2.0的新特色对样式表进行升级,这引起了我的兴趣。</P>

<P>  令人惊讶的是,我以前并没有考虑过样式表本身,而是在考虑如何应用样式表。这是因为原来的软件是用C#写的,现在很多开发者都在等待微软发布最新版本的MSXML来支持最新的标准,因为纸面上的标准是没有任何价值的,除非有实际的工作实例作为参考。</P>

<P>  如果您曾经为美国专利局工作过,那么按照这种思路进行思考:发布一种没有人知道怎么进行构建的产品专利有什么意义呢?实际上,除非您向风险投资推销雾件或标记技术领域的专利,空有想法只能做到这种程度了,那么下面让我们来看看如何在实际工作中使用XSLT2.0。</P>

<P>  <STRONG>软件资源</STRONG></P>

<P>  现在有很多现成的工具可以选择,首先,您需要微软的Visual C# Express来编写.NET代码,但是微软并没有提供XSLT的处理器,因此我们需要从Altova获取XSLT的处理工具。Altova是XMLSpy以及很多XML相关产品的软件生产商。</P>

<P>  且慢,先不用拿出您的支票本,我们所使用的来自Altova的软件是免费的——AltovaXML 2007,该产品包含了XML检验工具、XSLT1.0处理器、XSLT2.0处理器和XQuery处理器。我们最感兴趣的部分是XSLT2.0的处理功能,而微软的MSXML中恰好没有提供XSLT2.0的支持。</P>

<P>  关于微软Visual C# Express的安装可以参考以前的技术文章,这里就不再重复了,我们来介绍介绍AltovaXML 2007的安装,其实该过程也很简单,点击了安装文件并按照提示前进就可以了,图片A和B展示了您在安装过程中会看到的安装屏幕截图。</P>

<P align=center>图片A——安装过程<BR><A href="/TLimages/picview/?http://searchwebservices.techtarget.com.cn/imagelist/2007/135/8726efr9gyyk.jpg" target=_blank><img src="http://searchwebservices.techtarget.com.cn/imagelist/2007/135/8726efr9gyyks.jpg"></A><BR><div id="numpage">共5页。 <a  href="3334894.shtml" target="_self"><span>1</span></a> <a  href="3334894_1.shtml" target="_self">2</a> <a  href="3334894_2.shtml" target="_self">3</a> <a  href="3334894_3.shtml" target="_self">4</a> <a  href="3334894_4.shtml" target="_self">5</a> <a href="3334894_4.shtml" target="_self"><font face="Webdings">:</font></a></div>

    <br /><br /><a target=_blank href=http://searchwebservices.techtarget.com.cn/tips/394/3334894.shtml>点击看源文</a>

2007-5-21 18:36 admin




        作者: ,  出处:CNET中国, 责任编辑: 叶江, <div class="posted">2007-05-15 19:50</div>

    </div>

   



   

<div class="content">

    <h5>  这篇文章将向您介绍如何使用这些软件来应用XSLT2.0……</h5>

  <div id="pip">

   

  </div>

<div class="guanggao"><span id="contentAdv"></span></div></P>

<P align=center>图片B——安装过程的其他部分<BR><A href="/TLimages/picview/?http://searchwebservices.techtarget.com.cn/imagelist/2007/135/3r9jk08rbs44.jpg" target=_blank><img src="http://searchwebservices.techtarget.com.cn/imagelist/2007/135/3r9jk08rbs44s.jpg"></A></P>

<P>  在安装了AltovaXML 2007之后,使用XSLT2.0起来也很简单,只需要添加一个引用即可,如图片C所示。</P>

<P align=center>图片C——添加一个引用<BR><A href="/TLimages/picview/?http://searchwebservices.techtarget.com.cn/imagelist/2007/135/d6ev34n7tc8f.jpg" target=_blank><img src="http://searchwebservices.techtarget.com.cn/imagelist/2007/135/d6ev34n7tc8fs.jpg"></A><BR><div id="numpage">共5页。 <a href="3334894.shtml" target="_self"><font face="Webdings">9</font></a> <a  href="3334894.shtml" target="_self">1</a> <a  href="3334894_1.shtml" target="_self"><span>2</span></a> <a  href="3334894_2.shtml" target="_self">3</a> <a  href="3334894_3.shtml" target="_self">4</a> <a  href="3334894_4.shtml" target="_self">5</a> <a href="3334894_4.shtml" target="_self"><font face="Webdings">:</font></a></div>

   

2007-5-21 18:36 admin




        作者: ,  出处:CNET中国, 责任编辑: 叶江, <div class="posted">2007-05-15 19:50</div>

    </div>

   



   

<div class="content">

    <h5>  这篇文章将向您介绍如何使用这些软件来应用XSLT2.0……</h5>

  <div id="pip">

   

  </div>

<div class="guanggao"><span id="contentAdv"></span></div></P>

<P>  现在预备知识已经讲解完了,我们现在来创建一个C#程序,列表A是XML文档,列表B是XSLT文档,列表C是我们使用的C#程序代码。</P>

<P>  列表A——XML文档</P>

<P></WORLD>

<TABLE style="BORDER-RIGHT: #cccccc 1px dotted; TABLE-LAYOUT: fixed; BORDER-TOP: #cccccc 1px dotted; BORDER-LEFT: #cccccc 1px dotted; BORDER-BOTTOM: #cccccc 1px dotted" cellSpacing=0 cellPadding=6 width="95%" align=center border=0>

<TBODY>

<TR>

<TD style="WORD-WRAP: break-word" bgColor=#f3f3f3><FONT face=Verdana>&lt;?xml version="1.0" encoding="UTF-8"?&gt;<BR>&lt;world&gt;<BR>&lt;country name="Canada" continent="North America"&gt;<BR>&lt;city&gt;Toronto&lt;/city&gt;<BR>&lt;city&gt;Vancouver&lt;/city&gt;<BR>&lt;/country&gt;<BR>&lt;country name="Jamaica" continent="North America"&gt;<BR>&lt;city&gt;Kingston&lt;/city&gt;<BR>&lt;city&gt;Ocho Rios&lt;/city&gt;<BR>&lt;/country&gt;<BR>&lt;country name="United States" continent="North America"&gt;<BR>&lt;city&gt;Allentown&lt;/city&gt;<BR>&lt;city&gt;Mobile&lt;/city&gt;<BR>&lt;/country&gt;<BR>&lt;country name="United Kingdom" continent="Europe"&gt;<BR>&lt;city&gt;London&lt;/city&gt;<BR>&lt;city&gt;Dundee&lt;/city&gt;<BR>&lt;/country&gt;<BR>&lt;country name="France" continent="Europe"&gt;<BR>&lt;city&gt;Paris&lt;/city&gt;<BR>&lt;city&gt;Nice&lt;/city&gt;<BR>&lt;/country&gt;<BR>&lt;country name="Japan" continent="Asia"&gt;<BR>&lt;city&gt;Tokyo&lt;/city&gt;<BR>&lt;city&gt;Osaka&lt;/city&gt;<BR>&lt;/country&gt;<BR>&lt;/world&gt;</FONT></TD></TR></TBODY></TABLE></P>

<P>  列表B——XSLT2.0样式表</P>

<P><?xml:namespace prefix = xsl /><xsl:stylesheet xmlns:xdt="http://www.w3.org/2005/xpath-datatypes" xmlns:fn="</p>&#10;<p>  http://www.w3.org/2005/xpath-functions" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fo="</p>&#10;<p>  http://www.w3.org/1999/XSL/Format" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">

<TABLE style="BORDER-RIGHT: #cccccc 1px dotted; TABLE-LAYOUT: fixed; BORDER-TOP: #cccccc 1px dotted; BORDER-LEFT: #cccccc 1px dotted; BORDER-BOTTOM: #cccccc 1px dotted" cellSpacing=0 cellPadding=6 width="95%" align=center border=0>

<TBODY>

<TR>

<TD style="WORD-WRAP: break-word" bgColor=#f3f3f3><FONT face=Verdana>&lt;?xml version="1.0" encoding="UTF-8"?&gt;<BR>&lt;xsl:stylesheet version="2.0"xmlns:xsl="http://www.w3.org/1999/XSL/Transform"xmlns:fo="<BR>http://www.w3.org/1999/XSL/Format"xmlns:xs="http://www.w3.org/2001/XMLSchema"xmlns:fn="<BR>http://www.w3.org/2005/xpath-functions"xmlns:xdt="http://www.w3.org/2005/xpath-datatypes"&gt;<BR>&lt;xsl:template match="/"&gt;<BR>&lt;xsl:element name="world"&gt;<BR>&lt;xsl:for-each-group select="//country" group-by="@continent"&gt;<BR>&lt;xsl:sort select="@continent" data-type="text" order="ascending"/&gt;<BR>&lt;xsl:variable name="continent" select="@continent"/&gt;<BR>&lt;xsl:apply-templates select="//country[@continent = $continent]" mode="group"&gt;<BR>&lt;xsl:sort select="@name" data-type="text" order="ascending"/&gt;<BR>&lt;/xsl:apply-templates&gt;<BR>&lt;/xsl:for-each-group&gt;<BR>&lt;/xsl:element&gt;<BR>&lt;/xsl:template&gt;<BR>&lt;xsl:template match="*" mode="group"&gt;<BR>&lt;xsl:copy-of select="."/&gt;<BR>&lt;/xsl:template&gt;<BR>&lt;/xsl:stylesheet&gt;</FONT></TD></TR></TBODY></TABLE></xsl:stylesheet></P>

<div id="numpage">共5页。 <a href="3334894.shtml" target="_self"><font face="Webdings">9</font></a> <a  href="3334894.shtml" target="_self">1</a> <a  href="3334894_1.shtml" target="_self">2</a> <a  href="3334894_2.shtml" target="_self"><span>3</span></a> <a  href="3334894_3.shtml" target="_self">4</a> <a  href="3334894_4.shtml" target="_self">5</a> <a href="3334894_4.shtml" target="_self"><font face="Webdings">:</font></a></div>

   

2007-5-21 18:36 admin




        作者: ,  出处:CNET中国, 责任编辑: 叶江, <div class="posted">2007-05-15 19:50</div>

    </div>

   



   

<div class="content">

    <h5>  这篇文章将向您介绍如何使用这些软件来应用XSLT2.0……</h5>

  <div id="pip">

   

  </div>

<div class="guanggao"><span id="contentAdv"></span></div>

<P>  列表C——C#程序</P>

<P>

<TABLE style="BORDER-RIGHT: #cccccc 1px dotted; TABLE-LAYOUT: fixed; BORDER-TOP: #cccccc 1px dotted; BORDER-LEFT: #cccccc 1px dotted; BORDER-BOTTOM: #cccccc 1px dotted" cellSpacing=0 cellPadding=6 width="95%" align=center border=0>

<TBODY>

<TR>

<TD style="WORD-WRAP: break-word" bgColor=#f3f3f3>  using&nbsp;System; <BR>  using&nbsp;System.Collections.Generic; <BR>  using&nbsp;System.ComponentModel; <BR>  using&nbsp;System.Data; <BR>  using&nbsp;System.Drawing; <BR>  using&nbsp;System.Text; <BR>  using&nbsp;System.Windows.Forms; <BR>  namespace&nbsp;WindowsApplication1 <BR>  { <BR>  publicpartialclassForm1&nbsp;:&nbsp;Form <BR>  { <BR>  public&nbsp;Form1() <BR>  { <BR>  InitializeComponent(); <BR>  } <BR>  privatevoid&nbsp;Form1_Load(object&nbsp;sender,&nbsp;EventArgs&nbsp;e) <BR>  { <BR>  AltovaXMLLib.ApplicationClass&nbsp;objAltova&nbsp;=&nbsp;new&nbsp;AltovaXMLLib.ApplicationClass(); <BR>  textBox1.Text&nbsp;=&nbsp;Application.StartupPath&nbsp;+&nbsp;"....world2.xml"; <BR>  textBox2.Text&nbsp;=&nbsp;Application.StartupPath&nbsp;+&nbsp;"....grouping2.xsl"; <BR>  objAltova.XSLT2.InputXMLFileName&nbsp;=&nbsp;textBox1.Text; <BR>  objAltova.XSLT2.XSLFileName&nbsp;=&nbsp;textBox2.Text; <BR>  textBox3.Text&nbsp;=&nbsp;objAltova.XSLT2.ExecuteAndGetResultAsString(); <BR>  } <BR>  } <BR>  }</TD></TR></TBODY></TABLE></P>

<P>  示例</P>

<P>  在以上的代码中,我突出强调了这篇文章的主题——使用AltovaXML 2007的XSLT2.0功能。表A展示了应用到XSLT2.0的方法,表B展示了适用的属性。</P>

<P align=center>表A——方法<BR>

<TABLE style="WIDTH: 450px" borderColor=#000000 cellSpacing=0 cellPadding=0 width=450 align=center bgColor=#ffffff border=1 heihgt="">

<TBODY>

<TR>

<TD>&nbsp;方法</TD>

<TD>&nbsp;说明</TD></TR>

<TR>

<TD>&nbsp;Execute</TD>

<TD>&nbsp;对当前XML文档应用XSL样式表,并将结果写入程序提供的文件。</TD></TR>

<TR>

<TD>&nbsp;AddExternalParameter</TD>

<TD>&nbsp;在XSL样式表上添加一个参数值。</TD></TR>

<TR>

<TD>&nbsp;ClearExternalParameterList</TD>

<TD>&nbsp;清除所有XSL样式表参数。</TD></TR>

<TR>

<TD>&nbsp;ExecuteAndGetResultAsString</TD>

<TD>&nbsp;对当前XML文档应用XSL样式表,并返回结果字符串。</TD></TR></TBODY></TABLE></P>

<P align=center>表B——属性<BR>

<TABLE borderColor=#000000 cellSpacing=0 cellPadding=0 width=450 bgColor=#ffffff border=1 heihgt="">

<TBODY>

<TR>

<TD>&nbsp;方法</TD>

<TD>&nbsp;说明</TD></TR>

<TR>

<TD>&nbsp;InputXMLFileName</TD>

<TD>&nbsp;设定需要转换的XML文件名。</TD></TR>

<TR>

<TD>&nbsp;InputXMLFromText</TD>

<TD>&nbsp;从字符串获取需要转换的XML文件名。</TD></TR>

<TR>

<TD>&nbsp;LastErrorMessage</TD>

<TD>&nbsp;最后的错误信息字符串。</TD></TR>

<TR>

<TD>&nbsp;XSLFileName</TD>

<TD>&nbsp;设定XSLT样式表的文件名。</TD></TR>

<TR>

<TD>&nbsp;XSLFromText</TD>

<TD>&nbsp;从字符串获取样式表的文件名。</TD></TR>

<TR>

<TD>&nbsp;XSLStackSize</TD>

<TD>&nbsp;样式表中允许的最大递归深度,默认是是1000,最小值是100.</TD></TR></TBODY></TABLE><BR></P>

<div id="numpage">共5页。 <a href="3334894.shtml" target="_self"><font face="Webdings">9</font></a> <a  href="3334894.shtml" target="_self">1</a> <a  href="3334894_1.shtml" target="_self">2</a> <a  href="3334894_2.shtml" target="_self">3</a> <a  href="3334894_3.shtml" target="_self"><span>4</span></a> <a  href="3334894_4.shtml" target="_self">5</a> <a href="3334894_4.shtml" target="_self"><font face="Webdings">:</font></a></div>

   

2007-5-21 18:36 admin




        作者: ,  出处:CNET中国, 责任编辑: 叶江, <div class="posted">2007-05-15 19:50</div>

    </div>

   



   

<div class="content">

    <h5>  这篇文章将向您介绍如何使用这些软件来应用XSLT2.0……</h5>

  <div id="pip">

   

  </div>

<div class="guanggao"><span id="contentAdv"></span></div>

<P>  <STRONG>结果</STRONG></P>

<P>  应用以上所有的技术,我们得到的结果看上去应当和图片D差不多。</P>

<P align=center>图片D——结果<BR><A href="/TLimages/picview/?http://searchwebservices.techtarget.com.cn/imagelist/2007/135/f3dye1858369.jpg" target=_blank><img src="http://searchwebservices.techtarget.com.cn/imagelist/2007/135/f3dye1858369s.jpg"></A></P>

<P>  <STRONG>下一步如何开展</STRONG></P>

<P>  这个例子已经显示出XSLT2.0已经具备实际应用的价值了,尽管这个例子本身平淡无奇,但是通过免费资源,我们已经可以很好地利用XSLT2.0的强大功能了。</P>

<P>  但是在真正的商业环境中,您可能需要购买一些相关的参考资料,Michael Kay的XSLT 2.0 Programmer's Reference(XSLT2.0程序员参考指南)是一个不错的选择;另外,您可能还要花些钱在XMLSpy的完整版本上,不过放心,在真正的应用软件上,XMLSpy所发挥出的功能是值得您进行投资的。</P><div id="numpage">共5页。 <a href="3334894.shtml" target="_self"><font face="Webdings">9</font></a> <a  href="3334894.shtml" target="_self">1</a> <a  href="3334894_1.shtml" target="_self">2</a> <a  href="3334894_2.shtml" target="_self">3</a> <a  href="3334894_3.shtml" target="_self">4</a> <a  href="3334894_4.shtml" target="_self"><span>5</span></a></div>

   

2008-10-11 07:27 晨雾飞翔
快国庆了大家怎么安排

说说看都打算怎么过,我要和三鹿牛奶,喝一箱的说。





[img]http://recv.cn/upload/65539/2008-8/12008822062825782.gif[/img]
如何优雅的解决你面临的网站推广问题?[url=http://www.tgxzs%2ecom/]网站推广[/url]、[url=http://www.tgxzs%2ecom/]网络推广[/url]、[url=http://www.tgxzs.com/]群发软件[/url]、[url=http://www.tgxzs.com/]论坛群发[/url]、[url=http://www%2etgxzs.com/]竞价排名[/url]又将何去何从?

2008-10-20 19:24 晨雾飞翔
给大家推荐一个美女多的游戏

[size=4][color=#f70909][b]惊艳美女云集<美女三国> 千元大礼包人人有份
[/b][/color][/size][color=#cc5233]                                                       -------------三国类网页游戏的终极大作[/color]

   让人翘首以盼的由游戏盒子倾力打造的一款全新即时策略性网页游戏《美女三国之小乔出嫁》盛装开幕了。

[url=http://pass.boxgm.com/Box_UserReg.asp?Lid=100006][img]http://up.jdjsq.com/box_pop.jpg[/img][/url]   

    从[url=http://pass.boxgm.com/Box_UserReg.asp?Lid=100006][color=#800080]《美女三国》[/color][/url]sanguo.boxgm.com开区的预告发出,就有众多网友,来函来电咨询,问:美女三国 什么时候开始测试啊,什么时候正式开放啊。在此对一直支持我们的众多网友,和游戏盒子的120万老朋友们表示真挚的感谢!感谢你们对游戏盒子对[url=http://pass.boxgm.com/Box_UserReg.asp?Lid=100006][color=#800080]《美女三国》[/color][/url]的关注,支持和厚爱。   仅《美女三国之小乔初嫁》开服不足一个小时,便如潮水般涌进了近千的网友,开服次日注册用户就已突破万人。我们简单做了一下调查,其中以女性玩家人数最多,比例达到2/3 .

   金秋十月 丹桂飘香 ;金秋时月,暗香袭人,众多佳丽的加入,无疑也成了[url=http://pass.boxgm.com/Box_UserReg.asp?Lid=100006][color=#800080]美女三国[/color][/url]的一道亮丽的风景线。

  英雄榜也在不断的刷新,众多家族联盟也都踊跃的进入了[url=http://pass.boxgm.com/Box_UserReg.asp?Lid=100006][color=#800080]美女三国[/color][/url]。英雄的队伍也在不断的增长,在美女三国,有一展宏图,实现自己的统一霸业的为目标的霸业系玩家,还有誓复汉室一匡天下的忠义系玩家,也有是偏居一隅,求得安乐的 安乐系玩家。都在努力建立着自己的王国憧憬着自己的梦想。其逢乱世,究竟谁能成就霸业,谁能一匡天下,谁能称霸一方那。乱世造就几多悲歌,也成就几多英雄。自古美女爱英雄,英雄怜美女。金秋的十月,广邀天下英雄美女,共赴美女三国。建建千秋功业,留万古英明。那风华绝对,倾国倾城的美女,就是你!

   游戏盒子为了感谢众多网友对[url=http://pass.boxgm.com/Box_UserReg.asp?Lid=100006][color=#800080]《美女三国》[/color][/url]的厚爱和支持,决定让开区优惠活动延长至10月6日24时,每天参与答题边可获意外惊喜。美女三国伴你度过一个美好的假期。

   笔者也时尚了一把,带着对希望遇见美女一点憧憬,[url=http://pass.boxgm.com/Box_UserReg.asp?Lid=100006][color=#800080]开始了我的美女三国之旅[/color][/url],上班时间也可以玩!好不惬意,哇进游戏一看这么多的免费道具真是好爽啊。

   你还等什么呢,赶快[url=http://pass.boxgm.com/Box_UserReg.asp?Lid=100006][color=#800080]注册[/color][/url]!建立自己的王国。

游戏盒子《美女三国》官方网站 [url=http://pass.boxgm.com/Box_UserReg.asp?Lid=100006][color=#800080]http://pass.boxgm.com/Box_UserReg.asp?Lid=100006[/color][/url]
游戏盒子通行证注册地址[url=http://pass.boxgm.com/Box_UserReg.asp?Lid=100006][color=#800080]http://pass.boxgm.com/Box_UserReg.asp?Lid=100006[/color][/url]

[size=7][b][url=http://pass.boxgm.com/Box_UserReg.asp?Lid=100006]立即注册开始游戏吧![/url][/b][/size]

友情提示:[url=http://pass.boxgm.com/Box_UserReg.asp?Lid=100006][color=#800080]注册盒子通行证[/color][/url] 可以通行游戏盒子所有游戏!并且有免费的加速器软件可以用啊  简单简单加速器[url=http://www.jdjsq.com/][color=#0000ff]http://www.jdjsq.com[/color][/url] (终身免费)




[img]http://recv.cn/upload/65539/2008-8/12008822062825782.gif[/img]
如何优雅的解决你面临的网站推广问题?[url=http://www.tgxzs.com/]群发软件[/url]、[url=http://www.tgxzs.com/]论坛群发[/url]、[url=http://www.tgxzs.com/]网站推广[/url]又将何去何从?

页: [1]
查看完整版本: XSLT2.0应用实践


Powered by Discuz! Archiver 5.0.0  © 2001-2006 Comsenz Inc.