2
我有一个超链接列的sharepoint列表。xslt超链接,单独的url和descption
我把这个列表放入xml中并将xslt应用到它。
xml将在的形式产生输出:
<link>http://www.foo.com, http://www.foo.com</link>
如何可以使用XSLT我显示该链接?
感谢
我有一个超链接列的sharepoint列表。xslt超链接,单独的url和descption
我把这个列表放入xml中并将xslt应用到它。
xml将在的形式产生输出:
<link>http://www.foo.com, http://www.foo.com</link>
如何可以使用XSLT我显示该链接?
感谢
如何:
<xsl:template match="link">
<a href="{substring-before(.,',')}">
<xsl:value-of select="substring-after(.,',')"/>
</a>
</xsl:template>
对于XSLT 2.0
<xsl:template match="link">
<xsl:element name="a">
<xsl:attribute name="href">
<xsl:value-of select="substring-before(.,',')"/>
</xsl:attribute>
<xsl:value-of select="substring-after(.,',')"/>
</xsl:element>
</xsl:template>
虽然它使得略少可读性,扩展的语法被认为是很好的做法,当样式表变得很大。文字结果元素不像xsl:element/xsl:attribute那样容易操作XPath:
xslt 2.0是否不包含缩写语法? (根据我的文章) – 2009-02-27 14:31:16