【问题标题】:XSL value in HTML attributeHTML 属性中的 XSL 值
【发布时间】:2016-09-21 08:28:09
【问题描述】:

使用 XSL 我想生成一些如下所示的 HTML

<span title="some text">some other text</span>

替换some other text 很简单

<span title="some text"><xsl:value-of select="$someothertext"/></span>

some text 如何做到这一点?该文本在 HTML 元素的属性中,因此这成为无效的 XSL。

【问题讨论】:

    标签: xml xslt


    【解决方案1】:

    简单的方法是使用attribute value template

    <span title="{$sometext}"><xsl:value-of select="$someothertext"/></span>
    

    【讨论】:

      【解决方案2】:

      你可以使用属性标签来表示属性:

      <span>
        <xsl:attribute name="title">
          <xsl:value-of select="$sometext" />
        </xsl:attribute>
      </span>
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-01-11
        相关资源
        最近更新 更多