代码之家  ›  专栏  ›  技术社区  ›  David

HTML元素中的XSLT元素会导致错误

  •  0
  • David  · 技术社区  · 16 年前

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

    XSLT处理器由于此处的“<”符号而抛出错误。..

    2 回复  |  直到 16 年前
        1
  •  1
  •   Dror Big McLargeHuge    16 年前

    您可以使用:

    <img alt="logo" >
         <xsl:attribute name="src">
            /Content/Images/Logos/<xsl:value-of select="/customer/country"/>.png
         </xsl:attribute>
    </img>
    
        2
  •  0
  •   Brandon Gano    16 年前

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

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