【发布时间】:2017-04-27 12:06:40
【问题描述】:
我正在提取一个 rss 提要,其中包含一个笑话,然后是一些链接,用于在不同的服务上分享这个笑话。如下图:
值得注意的是,当我尝试从该输出中复制和粘贴文本时,链接并没有复制到记事本中,而是作为图片粘贴到 MS Word 中。
在我的 XSL 中,我使用
substring-before试图从我的输出中排除这些链接,但我能想到的唯一一致的字符是超链接中的<a href,它总是在最后。这可能吗?我第一次通过失败,是否应该包含一个转义字符?
也许我会尝试排除最后一个 X 字符以删除链接
很遗憾,我也找不到提要的 XML 版本,我的来源在这里:http://feeds.feedburner.com/DailyJokes-ACleanJokeEveryday?format=xml
这是我正在使用的 XSL,它目前被硬编码以在最近的笑话结束时中断(我的下一个障碍是遍历这个列表)
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>
<xsl:template match="/">
<xsl:apply-templates select="//item[position() < 2]"/>
</xsl:template>
<xsl:template match="item">
<content-item>
<h1><xsl:value-of select="title"/></h1>
<p><xsl:value-of select="substring-before(description, 'mower')" disable-output-escaping="yes"/></p>
<br/><br/>
<p>"The following is here for testing purposes and will be removed"<br/><br/><xsl:value-of select="substring-after(description, 'lawn')" disable-output-escaping="yes"/></p>
<br/><br/>
</content-item>
</xsl:template>
</xsl:stylesheet>
我正在通过 SharePoint 2013 RSS 源 Web 部件呈现我的输出
【问题讨论】:
标签: xslt rss substring sharepoint-2013 html-escape-characters