XSLT属性字符串测试

时间:2018-09-10 21:57:29

标签: xml testing xslt attributes

我正在编辑一些现有的XSLT,因此可以更改内容的显示以显示在选项卡中。我使用了一个字符串变量来为单个样式分配一个div id。我现在正在尝试测试第一个选项卡名称的新id属性,然后将该选项卡的样式设置为display:block。我知道WHEN条件正在处理,因为一种样式已应用于div,但这全是display:none

我不是特别擅长XSLT(深度学习曲线),但是我却一无所获,但是后一点才起作用,我认为这只是因为我不知道正确的语法。这是我正在使用的模块。显示整个div块,但重要的是前十二行:

  <div class="container">
<xsl:attribute name="id">
    <xsl:value-of select="substring($tmpTitle, 1, 5)"/>
</xsl:attribute>
<xsl:choose>
        <xsl:when test="@id='First'">
             <xsl:attribute name="style">display:block</xsl:attribute>
        </xsl:when>
        <xsl:otherwise>
            <xsl:attribute name="style">display:none</xsl:attribute>
        </xsl:otherwise>
</xsl:choose>

<li>

    <h2>
        <xsl:value-of select="$tmpTitle"/>
    </h2>

    <xsl:if test="$listType != ''">
        <a class="guidelinesLink">
            <xsl:attribute name="href">
                <xsl:apply-templates select="link"/>
            </xsl:attribute>
            <xsl:value-of select="link/url-text"/>
        </a>
    </xsl:if>


    <ul class="itemList">
        <xsl:apply-templates select="//item[../title = $tmpTitle or ../title-ddl = $tmpTitle]">
            <xsl:sort select="title"/>
        </xsl:apply-templates>
    </ul>

</li>
</div>

0 个答案:

没有答案