【问题标题】:XSLT element in HTML element leads to errorsHTML 元素中的 XSLT 元素导致错误
【发布时间】:2009-06-03 12:13:06
【问题描述】:

我怎么能意识到这样的事情:

<img alt="logo" src="/Content/Images/Logos/<xsl:value-of select="/customer/country"/>.png" />

XSLT 处理器由于“

【问题讨论】:

    标签: html xslt xhtml


    【解决方案1】:

    你可以使用:

    <img alt="logo" >
         <xsl:attribute name="src">
            /Content/Images/Logos/<xsl:value-of select="/customer/country"/>.png
         </xsl:attribute>
    </img>
    

    【讨论】:

      【解决方案2】:

      元素不能嵌套在属性值中。您可以使用 {...} 来嵌入 XPath,如下所示:

      <img alt="logo" src="/Content/Images/Logos/{/customer/country}.png" />
      

      【讨论】:

        猜你喜欢
        • 2020-11-03
        • 1970-01-01
        • 2014-08-02
        • 1970-01-01
        • 2021-02-17
        • 1970-01-01
        • 2021-09-03
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多