在XSL中引用自身数据的两种方法

ZDNet软件频道 时间:2008-06-29 作者:孟宪会 | 中国IT实验室 我要评论()
本文关键词:引用 XSL xml 软件
在XSL中引用自身数据的两种方法,如果你使用Msxml解析器,你可以用方法二:
 在XSL引用自身数据的两种方法,如果你使用Msxml解析器,你可以用方法二:
  
  
  方法一
  
  <?xml version="1.0" encoding="UTF-8"?>
  <XSL:stylesheet version="1.0" xmlns:XSL="http://www.w3.org/1999/XSL/Transform"
   xmlns:mxh="http://xml.sz.luohuedu.net/">
   <XSL:template match="/">
   <mxh:Root>
   <Line Val="1"/>
   <Line Val="2"/>
   <Line Val="3"/>
   </mxh:Root>
   <XSL:for-each select="document('')/XSL:stylesheet/XSL:template/mxh:Root/Line">
   <XSL:value-of select="@Val"/>
   </XSL:for-each>
   </XSL:template>
  </XSL:stylesheet>
  方法二
  
  <?xml version="1.0" encoding="UTF-8"?>
  <XSL:stylesheet version="1.0"
   xmlns:XSL="http://www.w3.org/1999/XSL/Transform"
   xmlns:msXSL="urn:schemas-microsoft-com:XSLt">
   <XSL:template match="/">
   <XSL:variable name="Array">
   <Root>
   <Line Val="1"/>
   <Line Val="2"/>
   <Line Val="3"/>
   </Root>
   </XSL:variable>
   <XSL:for-each select="msXSL:node-set($Array)/Root/Line">
   <XSL:value-of select="@Val"/>
   </XSL:for-each>
   </XSL:template>
  </XSL:stylesheet>

引用

XSL

xml

软件


百度大联盟认证黄金会员Copyright© 1997- CNET Networks 版权所有。 ZDNet 是CNET Networks公司注册服务商标。
中华人民共和国电信与信息服务业务经营许可证编号:京ICP证010391号 京ICP备09041801号-159
京公网安备:1101082134