我有这种 XML ,<platform>
和<source>
的网址开头类似:
<informations>
<platform>http://networkcultures.org/</plateforme>
<source>http://networkcultures.org/wpmu/theoryondemand/2011/07/11/distant-reading/</source>
</informations>
我想知道 XSL 如何在 HTML 中输出此输出,以便在开头合并/连接两个标记并在之后其余 <source>
:
<span class="url">
<span class="platform"><xsl:value-of select="platform"/></span>
<xsl:value-of select="the rest of <source>"/>
</span>
我搜索了<xsl:key>
或generate-id()
但没有成功。希望你能理解我的问题。谢谢你的帮助!
答案 0 :(得分:1)
更改第二个<xsl:value-of>
,如下所示:
<span class="url">
<span class="platform"><xsl:value-of select="platform"/></span>
<xsl:value-of select="substring-after(source, platform)" />
</span>
这假设<platform>
的字符串值总是出现在<source>
的开头。否则,substring-after()
将返回一个空字符串。
这将给出,例如
<span class="url">
<span class="platform">http://networkcultures.org/</span>wpmu/theoryondemand/2011/07/11/distant-reading/
</span>