小编Set*_*eth的帖子

限制字符串中的字符数 - XSLT

我正在使用第三方asp.net控件来从数据库中提取和显示最新内容.该控件使用xsl文件提取最新发布内容的标题.我的问题是标题(内容片段)太长.我以前用过的地方显示没有大约100个字符的空间.我需要修剪(不是白色空格)结束部分,并可能将其限制为几个单词或一些字符.它使用xsl文件 -

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
        <table border="0" cellspacing="0" cellpadding="0" width="100%">
            <xsl:for-each select="Collection/Content">
                <tr>
                    <td>
                        <a>
                            <xsl:attribute name="href">
                                <xsl:choose>
                                    <xsl:when test="Type ='Assets' or Type = 8 ">
                                        javascript:void window.open('showcontent.aspx?id=<xsl:value-of select="ID"/>')
                                    </xsl:when>
                                    <xsl:otherwise>
                                        <xsl:value-of select="QuickLink"/>
                                    </xsl:otherwise>
                                </xsl:choose>
                            </xsl:attribute>
                            <xsl:value-of select="Title"/>
                        </a>
                    </td>
                </tr>
            </xsl:for-each>
        </table>
    </xsl:template>
Run Code Online (Sandbox Code Playgroud)

这一部分,<xsl:value-of select="Title"/>是你的标题所在,我需要缩短它...(也许......最后......)

我该怎么做?我可以在不使用JQuery的情况下在xsl文件中完成此操作吗?非常感谢,

asp.net xslt xpath character limit

3
推荐指数
1
解决办法
1万
查看次数

标签 统计

asp.net ×1

character ×1

limit ×1

xpath ×1

xslt ×1