Html 如何通过<;xsl:value of>;标签?

Html 如何通过<;xsl:value of>;标签?,html,xslt,abbr,Html,Xslt,Abbr,以下是我的xml代码: <abbr> <title>world health organization</title>who</abbr> was founded in 1948. (世界卫生组织+世卫组织) 现在,我不想要第一部分。 如何实现这一点?由于title是abbr的子项,title的文本是abbr字符串值的一部分。请试试这个: <xsl:template match ="abbr"> <abbr title="

以下是我的xml代码:

<abbr>
<title>world health organization</title>who</abbr>
was founded in 1948. 
(世界卫生组织+世卫组织)

现在,我不想要第一部分。
如何实现这一点?

由于
title
abbr
的子项,
title
的文本是
abbr
字符串值的一部分。请试试这个:

<xsl:template match ="abbr">
  <abbr title="{title}">
    <xsl:apply-templates select="text()"/>
  </abbr>
</xsl:template>

顺便问一下,您是否在XSLT中使用
xsl:output method=“text”
?如果您使用XSLT生成XML,那么应该使用
method=“XML”
。这就是XSLT的用途

<xsl:template match ="abbr">
&lt;abbr title="<xsl:value-of select ="title"/>"&gt;
<xsl:value-of select ="."/>&lt;/abbr&gt;
</xsl:template>
<abbr title="world health organization">
world health organizationwho</abbr>
<xsl:value-of select"."/> 
world health organisationwho
<xsl:template match ="abbr">
  <abbr title="{title}">
    <xsl:apply-templates select="text()"/>
  </abbr>
</xsl:template>