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

如何在不关闭XSLT的情况下打印单个<div>

  •  2
  • DonutReply  · 技术社区  · 14 年前

    基本上,我需要在一个if语句中打开一个DIV,然后在另一个语句中关闭它。我试过

    <xsl:value-of select="'<div>'"/>
    

    但失败的原因是属性中不允许<和>。有什么想法吗? 干杯

    4 回复  |  直到 14 年前
        1
  •  5
  •   LarsH    14 年前

    <div>

      <xsl:choose>
         <xsl:when test="myConditionIsTrue">
            <div>
               <xsl:call-template name="bar"/>
            </div>
         </xsl:when>
         <xsl:otherwise>
            <xsl:call-template name="bar"/>            
         </xsl:otherwise>
      </xsl:choose>
    

    <xsl:call-template> <xsl:apply-templates> <xsl:value-of select="$myvariable" />

        2
  •  3
  •   DonutReply    14 年前

    <xsl:text disable-output-escaping="yes">&lt;div&gt;</xsl:text>
    

        3
  •  1
  •   Armstrongest    14 年前

    &lt; &gt; < >

        4
  •  0
  •   Karmic Coder    14 年前

    <xsl:text disable-output-escaping="yes">&lt;div&gt;</xsl:text>
    

    推荐文章