以文本方式查看主题

-  中文XML论坛 - 专业的XML技术讨论区  (http://bbs.xml.org.cn/index.asp)
--  『 XSL/XSLT/XSL-FO/CSS 』  (http://bbs.xml.org.cn/list.asp?boardid=8)
----  关于如何用xsl:for-each-group分组?  (http://bbs.xml.org.cn/dispbbs.asp?boardid=8&rootid=&id=61443)


--  作者:w3cxml
--  发布时间:4/16/2008 2:43:00 PM

--  关于如何用xsl:for-each-group分组?
<!----------------------------------test.xml------------------------------------------->
<?xml version="1.0" encoding="utf-8"?>
<?xml:stylesheet type="text/xsl" href="test.xslt"?>
<SD_Info>    
 <共有信息>  
  <共有 num="1">
   <类别>建筑区划内</类别>
   <名称>喷池</名称>
   <部位>东</部位>
   <面积大小>19.23</面积大小>
   <数量>0</数量>
  </共有> 
  <共有 num="2"> 
   <类别>建筑区划内</类别>
   <名称>花园</名称>
   <部位>333</部位>
   <面积大小>2</面积大小>
   <数量>10</数量>
  </共有>   
  <共有 num="3">
   <类别>栋内</类别>
   <名称>楼梯间</名称>
   <面积大小>15.34</面积大小>
   <部位>每层共有</部位>
   <数量>9</数量>
  </共有> 
  <共有 num="4">
   <类别>栋内</类别>
   <名称>管道井</名称>
   <面积大小>15.34</面积大小>
   <部位>每层共有</部位>
   <数量>12</数量>
  </共有> 
 </共有信息>
</SD_Info>
<!----------------------------------test.xsltl------------------------------------------->
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions">
 <xsl:template match="SD_Info">
<html>
<head>
<title></title>
</head>
<body>
<table border="1">  
 <tr>
  <td>类别</td>
  <td>名称</td>
  <td>部位</td>
  <td>面积大小</td>
  <td>数量</td>  
 </tr>  
 <xsl:for-each select="共有信息" >
  <xsl:for-each-group select="共有" group-by="类别">
   <tr>
    <td>
    <xsl:value-of select="类别"/>
    </td>
    <td>
    <xsl:value-of select="名称"/>
    </td>
    <td>
    <xsl:value-of select="部位"/>
    </td>
    <td>
    <xsl:value-of select="面积大小"/>
    </td>
    <td>
    <xsl:value-of select="数量"/>
    </td>
   </tr>
  </xsl:for-each-group>
 </xsl:for-each>
</table> 
</body>
</html>
</xsl:template>
</xsl:stylesheet>
我是这样写的分组的,运行时,为什么出现
"Keyword xsl:for-each may not contain xsl:for-each-group."
的错误呢?
要么出现"Keyword template may not contain xsl:for-each-group."
--  作者:belinda_pjm
--  发布时间:4/16/2008 2:50:00 PM

--  
xsl中没有  <xsl:for-each-group > 只有<xsl:for-each >
--  作者:w3cxml
--  发布时间:4/16/2008 6:13:00 PM

--  
xsl 2.0不是有xsl:for-each-group这个元素吗?
--  作者:hugh151721
--  发布时间:1/9/2009 1:47:00 PM

--  
你好 ,我现在也遇到同样的问题,请问你解决了 吗 ?
W 3 C h i n a ( since 2003 ) 旗 下 站 点
苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
46.875ms