如何在for循环中实现xslt请帮帮我 [英] how to implement xslt in for loop please help me

查看:68
本文介绍了如何在for循环中实现xslt请帮帮我的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在xslt中编写for循环:

how to write a for loop in xslt:

<?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" exclude-result-prefixes="msxsl"

>

  <xsl:template name="DYSAVRINDATA">
    <xsl:param name="ReportType" />


    <BR></BR>
    <p class="tagname">
      <xsl:text>AVR DATA</xsl:text>
    </p>
    <TABLE BORDER="1" class="sample" >
      <TR  class="header">
        <xsl:for-each select="TITLES/*">
          <TD>
            <xsl:value-of select="."/>
          </TD>
        </xsl:for-each>
      </TR>
      <xsl:for-each select="DYSAVRINDATAROWS_DATA/ROWDATA">
        <xsl:choose>
          <xsl:when test="$ReportType = 1">
            <TR class="datacellone">
              <xsl:variable name="childnodes" select="*"/>
              <!--all children-->
              <xsl:for-each select="$childnodes">
                <TD>

                  <xsl:value-of select="."/>

                </TD>
              </xsl:for-each>
            </TR>
          </xsl:when>
          <xsl:otherwise>
            <xsl:for-each select="CASE_NO">
              <tr>
                <xsl:attribute name="bgcolor">
                  <xsl:call-template name="color">
                    <xsl:with-param name="ref">
                      <xsl:value-of select="@ref" />
                    </xsl:with-param>
                  </xsl:call-template>
                </xsl:attribute>
                <!--<TD>
                      <xsl:value-of select="@id" />
                    </TD>-->
                <xsl:variable name="childnodes" select="*"/>
                <xsl:for-each select="$childnodes">
                  <TD >
                    <xsl:value-of select="."/>
                  </TD>
                </xsl:for-each>
              </tr>
            </xsl:for-each>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:for-each>
      <xsl:apply-templates/>
    </TABLE>
  </xsl:template>
</xsl:stylesheet>





修改并给我



modify and give me

推荐答案

ReportType = 1 >
< TR < span class =code-attribute> class = datacellone >
< xsl:variable < span class =code-attribute> name = childnodes 选择 = * / >
<! - 所有孩子 - >
< xsl:for-each 选择 =
ReportType = 1"> <TR class="datacellone"> <xsl:variable name="childnodes" select="*"/> <!--all children--> <xsl:for-each select="


childnodes >
< 道明 >

< xsl:value-of select = / >

< / TD >
< / xsl:for-each >
< / TR >
< / xsl:when >
< xsl:否则 >
< span class =code-keyword>< xsl:for-each 选择 = CASE_NO >
< ; tr >
< xsl:attribute name = bgcolor >
< xsl:call-template 名称 = color >
< xsl:with- param name = ref >
< xsl:value-of 选择 = @ref / >
< / xsl:with-param >
< / xsl:call-template >
< / xsl:attribute >
<! - < TD>
< xsl:value-of select =@ id/>
< / TD>
- >

< ; xsl:variable name = childnodes 选择 = * / >
< xsl:for-each select =
childnodes"> <TD> <xsl:value-of select="."/> </TD> </xsl:for-each> </TR> </xsl:when> <xsl:otherwise> <xsl:for-each select="CASE_NO"> <tr> <xsl:attribute name="bgcolor"> <xsl:call-template name="color"> <xsl:with-param name="ref"> <xsl:value-of select="@ref" /> </xsl:with-param> </xsl:call-template> </xsl:attribute> <!--<TD> <xsl:value-of select="@id" /> </TD>--> <xsl:variable name="childnodes" select="*"/> <xsl:for-each select="


childnodes >
< TD >
< xsl:value-of 选择 = / >
< / TD >
< / xsl:for-each >
< < span class =code-leadattribute> / tr >
< / xsl:for-each >
< / xsl:否则 < span class =code-keyword>>
< / xsl:choose >
< / xsl:for-each >
< xsl:apply-templates / >
< / TABLE >
< / xsl:template >
< / xsl:stylesheet >
childnodes"> <TD > <xsl:value-of select="."/> </TD> </xsl:for-each> </tr> </xsl:for-each> </xsl:otherwise> </xsl:choose> </xsl:for-each> <xsl:apply-templates/> </TABLE> </xsl:template> </xsl:stylesheet>





修改并给我



modify and give me


这篇关于如何在for循环中实现xslt请帮帮我的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆