首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > XML SOAP >

求XSL兑现

2012-12-30 
求XSL实现。 table cellspacing0 classelReportBody idreport_table_21tr height25 idtr_

求XSL实现。


 <table cellspacing="0" class="elReportBody" id="report_table_21">                             
                                <tr height="25" id="tr_21_00001">
                                    <td class="left">1</td>
                                    <td class="left">00014041</td>
                                    <td class="left">单笼施工电梯100m(试车台班)</td>
                                    <td class="center">?</td>
                                </tr>
                                <tr height="25" id="tr_21_00002">
                                    <td class="left">2</td>
                                    <td class="left">00014035</td>
                                    <td class="left">自升式塔式起重机2000kN?m(试车台班)</td>
                                    <td class="center">?</td>
                                </tr>
 </table>
  <table cellspacing="0" class="elReportBody" id="report_table_22">
                              <tr height="25" id="tr_22_00001">
                                    <td class="center">台班</td>
                                    <td>3.000</td>


                                    <td>262.61</td>
                                    <td>787.83</td>
                                    <td class="left">?</td>
                                </tr>
                                <tr height="25" id="tr_22_00002">
                                    <td class="center">台班</td>
                                    <td>2.000</td>
                                    <td>881.51</td>
                                    <td>1,763.02</td>
                                    <td class="left">?</td>
                                </tr>
 </table>



想实现XSL整理后依次输出第一个TABEL的第一个TR和第二个TABEL的第一个TR。然后是第一个TABEL的第二个TR和第二个TABEL的第二个TR。
[解决办法]
你大致可以这样
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:template match="/data">
<xsl:apply-templates select="table[@id='report_table_21']"></xsl:apply-templates>
  </xsl:template>
<xsl:template match="table">
<table border="1">
<xsl:for-each select="tr">

<xsl:copy-of select="."/>
<xsl:call-template name="table2">
<xsl:with-param name="index" select="position()"></xsl:with-param>
</xsl:call-template>
</xsl:for-each>
</table>
</xsl:template>
<xsl:template name="table2">
<xsl:param name="index"/>
<xsl:copy-of select="//table[@id='report_table_22']/tr[position()=$index]"/>
</xsl:template>
</xsl:stylesheet>

热点排行