Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xslt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
删掉RSS提要标题的前10个字符_Rss_Xslt - Fatal编程技术网

删掉RSS提要标题的前10个字符

删掉RSS提要标题的前10个字符,rss,xslt,Rss,Xslt,我正在尝试编写一些xsl来设计RSS提要的样式。我需要删掉每个项目标题的前10个字符 <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="/rss"> <ul> <xsl:for-each select="

我正在尝试编写一些xsl来设计RSS提要的样式。我需要删掉每个项目标题的前10个字符

<?xml version="1.0" encoding="ISO-8859-1"?> 
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/rss">
<ul>
<xsl:for-each select="channel/item">
<li><strong><xsl:value-of select="title"/>
</strong>
<a href="{link}">More</a></li>
</xsl:for-each>
</ul>
</xsl:template>

<xsl:template name="trimtitle">
<xsl:param name="string" select="." />
<xsl:if test="$string">
<xsl:text>Foo</xsl:text>
<xsl:call-template name="trimtitle">
<xsl:with-param name="string" select="substring($string, 10)" />
</xsl:call-template>
</xsl:if>
</xsl:template>

<xsl:template match="title">
<xsl:call-template name="title" />
<xsl:value-of select="." />
</xsl:template>


</xsl:stylesheet>


我认为您应该这样编写子字符串函数:

子字符串($string,1,10)

看看这里


您在trimtitle模板中做什么? 你为什么打电话给我

显示修剪字符串的最简单方法是:

<xsl:value-of select="substring(title,0,10)"/>


您忘了提供源XML文档(请简短)。谢谢-这正是我所需要的,以简化我正在尝试的混乱。我很感激。