• λ我爱Aspx >> Asp.Net >> 在XSL中引用自身数据的两种方法
  • 在XSL中引用自身数据的两种方法

  • :aspxer  Դ:internet  :2007-5-15 20:46:34  ؼ:数据
  • 在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中得到某节点到根节点的全路径的所有节点?

    下一篇: 利用XSL对XML数据进行加密和大小写转换

    Ҷƪл˵?
  • һƪ使用ASP的Dictionary对象打造完美购物车
    һƪ在XSLT中实现按日期排序