如何增加 XSL 整数变量 [英] How to increment a XSL integer variable

查看:20
本文介绍了如何增加 XSL 整数变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

更新

我有一些巨大的数据,它变成了一个大表说表父

每个表父的行将对应另一个表(下面给出的代码)说表子所以当来自表父的任何特定列strong> 行被点击(超链接)它转到表的那部分 table child

所以我需要一个计数器来区分每个表孩子.请帮我解决这个问题.谢谢

<xsl:variable name="counter" as="xs:integer"/>$counter=0 <!--这里我指定的是 0--><xsl:when test="DBInfo/ORSDBInfo/ORSReposTableTypeInd1/ORSReposColumAllWithTableTypeInd1/@ColumnNm"><dd><xsl:for-each select="DBInfo/ORSDBInfo/ORSReposTableTypeInd1"><div class="horz"><a name="_ORS$counter" href="#_top">ORSReposColumAllWithTableTypeInd1:<xsl:value-of select="$counter"/></a><表格边框=1"><!--上面我正在使用计数器打印--><tr><th>创作者</th><th>LastUpdate</th><th>UpdatedBy</th></tr><xsl:for-each select="ORSReposColumAllWithTableTypeInd1"><tr><td><xsl:value-of select="@Creator"/></td><td><xsl:value-of select="@LastUpdate"/></td><td><xsl:value-of select="@UpdatedBy"/></tr></xsl:for-each></tbody>

$counter=$counter+1 <br/></xsl:for-each></dd></xsl:when><xsl:否则></xsl:否则></xsl:选择>

更多更新

所以在参考威尔弗雷德的回答后,我想出了

<a name="_ORS" href="#_top">ORSReposColumAllWithTableTypeInd1_<xsl:number value="position()" format="1"/></a>

但是现在如何在 <a name="_ORS" 中使用它,以便我得到 _ORS1、_ORS2、_ORS3 等等...

解决方案

如何使用:

参见 http://www.w3.org/TR/xslt#number

有多种方法可以将其作为属性包含在锚标记中.

选项 1:使用变量

<xsl:数字/></xsl:变量><a name="{$number}">blabla</a>

选项 2:xsl:attribute

<xsl:attribute name="name"><xsl:数字/></xsl:attribute></a>

Updated

I have some huge data, which becomes a large table say table parent

each table parent's row will correspond to another table (code given below) say table child So when any particular column from the table parent row is clicked (hyperlinked) it goes to that part of table table child

so i need a counter to differentiate between each table child. Please help me figure out this problem. Thanks

<xsl:choose>
    <xsl:variable name="counter" as="xs:integer"/>
    $counter=0      <!--here i am assigning 0-->
    <xsl:when test="DBInfo/ORSDBInfo/ORSReposTableTypeInd1/ORSReposColumAllWithTableTypeInd1/@ColumnNm">
        <dd>
            <xsl:for-each select="DBInfo/ORSDBInfo/ORSReposTableTypeInd1">
                <div class="horz">
                <a name="_ORS$counter" href="#_top">ORSReposColumAllWithTableTypeInd1:<xsl:value-of select="$counter"/> </a>
                <table border="1">          <!--above I am using counter to print-->
                    <tbody>
                        <tr>
                            <th>Creator</th>
                            <th>LastUpdate</th>
                            <th>UpdatedBy</th>
                        </tr>
                <xsl:for-each select="ORSReposColumAllWithTableTypeInd1">
                    <tr>
                        <td><xsl:value-of select="@Creator"/></td>
                        <td><xsl:value-of select="@LastUpdate"/></td>
                        <td><xsl:value-of select="@UpdatedBy"/>
                    </tr>
                </xsl:for-each>
                    </tbody>
                </table>
            </div>
            $counter=$counter+1     <!--Counter is incremented-->
            <br/>
            </xsl:for-each>
        </dd>
    </xsl:when>
    <xsl:otherwise>
    </xsl:otherwise>
</xsl:choose>

More Updates

So after referring to Wilfred's answer I came up with

<a name="_ORS" href="#_top">ORSReposColumAllWithTableTypeInd1_<xsl:number value="position()" format="1" /></a>

but now how to use it inside <a name="_ORS" so that i get _ORS1, _ORS2, _ORS3 and so on...

解决方案

What about using:

<xsl:number/>

See http://www.w3.org/TR/xslt#number

There are various ways to include it as attributes into your anchor tag.

Option 1: Using variables

<xsl:variable name="number">
  <xsl:number/>
</xsl:variable>
<a name="{$number}">blabla</a>

Option 2: xsl:attribute

<a>
  <xsl:attribute name="name">
    <xsl:number/>
  </xsl:attribute>
</a>

这篇关于如何增加 XSL 整数变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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