关于XSLT的for-each用法
原格式如下: 
  <span   row= "1 "   col= "1 "/>  
  <span   row= "1 "   col= "2 "/>     
  <span   row= "2 "   col= "1 "/>  
 .....................   
 目标格式: 
  <row   index= "1 ">  
        <col   index= "1 "/>  
  </row>  
 .........   
 应该如何处理?
------解决方案--------------------没看出什么对应关系。可以使用xslt将一个xml转换成另外一个xml的, 
 类似 
 http://blog.csdn.net/net_lover/archive/2002/05/16/6900.aspx
------解决方案--------------------cdcatalog.html   
  <html>  
  <body>  <script type= "text/javascript "> // Load XML  
 var xml = new ActiveXObject( "Microsoft.XMLDOM ") 
 xml.async = false 
 xml.load( "cdcatalog.xml ")// Load XSL 
 var xsl = new ActiveXObject( "Microsoft.XMLDOM ") 
 xsl.async = false 
 xsl.load( "cdcatalog.xsl ")// Transform 
 document.write(xml.transformNode(xsl)) </script>  </body>  
  </html>      
 ------------------------ 
 cdcatalog.xml   
  <?xml version= "1.0 " encoding= "ISO-8859-1 "?>  
  <catalog>  
    <cd>  
      <title> Empire Burlesque </title>  
      <artist> Bob Dylan </artist>  
      <country> USA </country>  
      <company> Columbia </company>  
      <price> 10.90 </price>  
      <year> 1985 </year>  
    </cd>  
  </catalog>      
 ------------------------ 
 cdcatalog.xsl     
  <?xml version= "1.0 " encoding= "ISO-8859-1 "?>  
  <xsl:stylesheet version= "1.0 " 
 xmlns:xsl= "http://www.w3.org/1999/XSL/Transform ">  <xsl:template match= "/ ">  
    <html>  
    <body>  
      <h2> My CD Collection </h2>   
      <table border= "1 ">  
        <tr bgcolor= "#9acd32 ">  
          <th align= "left "> Title </th>   
          <th align= "left "> Artist </th>   
        </tr>  
        <xsl:for-each select= "catalog/cd ">           ---- for-each读取xml节点 
        <tr>  
          <td>  <xsl:value-of select= "title " />  </td>  
          <td>  <xsl:value-of select= "artist " />  </td>  
        </tr>  
        </xsl:for-each>  
    </table>  
    </body>  
    </html>  
  </xsl:template>  </xsl:stylesheet>
------解决方案--------------------xsl:foreach----------循环SPAN 
 xsl:if (@row) 
 creamteelement(row) 
 xsl:if (@col) 
 createelement(col) 
 .............     
 伪代码, 
 下面有结构转换的例子 
 http://blog.csdn.net/honkerhero/archive/2007/03/14/1528837.aspx
------解决方案--------------------http://blog.csdn.net/net_lover/archive/2002/05/16/6900.aspx