2007-10-11

XSLT 2.0应用实践

来源: 开发者在线 作者: 评论 0 条
 ">

< city> Kingston</city>

< city> Ocho Rios</city>

</country>

<country name="United States" continent="North America">

< city> Allentown</city>

< city> Mobile</city>

</country>

<country name="United Kingdom" continent="Europe">

< city> London</city>

< city> Dundee</city>

</country>

<country name="France" continent="Europe">

< city> Paris</city>

< city> Nice</city>

</country>

<country name="Japan" continent="Asia">

< city> Tokyo</city>

< city> Osaka</city>

</country>

</world>

列表 B —— XSLT2.0 样式表

<?xml version="1.0" encoding="UTF-8"?>

< xsl:stylesheet version="2.0"xmlns:xsl="http://www.w3.org/1999/XSL/Transform"xmlns:fo="

http://www.w3.org/1999/XSL/Format"xmlns:xs="http://www.w3.org/2001/XMLSchema"xmlns:fn="

http://www.w3.org/2005/xpath-functions"xmlns:xdt="http://www.w3.org/2005/xpath-datatypes">

< xsl :template match="/">

< xsl :element name="world">

< xsl :for -each-group select="//country" group-by="@continent">

< xsl :sort select="@continent" data-type="text" order="ascending"/>

< xsl :variable name="continent" select="@continent"/>

< xsl :apply -templates select="//country[@continent = $continent]" mode="group">

< xsl :sort select="@name" data-type="text" order="ascending"/>

</ xsl :apply -templates>

</ xsl :for -each-group>

</ xsl :element >

</ xsl :template >

< xsl :template match="*" mode="group">

< xsl :copy -of select="."/>

</ xsl :template >
共4页: 上一页 [1] 2 [3] [4] 下一页

(本文仅表明作者个人观点,不代表本站及其管理员立场.) 推荐 收藏 投稿 打印 返回 关闭
上一篇:PHP基础知识:PHP4和PHP5的配置异同比较  
下一篇:实际操作PHP:用PHP编写的网上调查投票系统
    评论加载中…
 推荐文章
     

网站首页  -  网站地图 -   站长论坛  -  网站投稿  -    -  网站管理
Copyright © 2008 芜湖站长站 All Rights Reserved 皖ICP备07500611号