相关疑难解决方法(0)

在xslt concat函数中转义单引号

我想在下面的xsl:value-of xsl statment中输出$ ID变量周围的单引号.

<xsl:value-of select="concat('process[@Ref=',$ID,']')"></xsl:value-of>
Run Code Online (Sandbox Code Playgroud)

目前它打印

process@Ref=87799989
Run Code Online (Sandbox Code Playgroud)

请让我知道如何实现这一目标.

谢谢,Keshav

javascript xml xslt

48
推荐指数
4
解决办法
7万
查看次数

XSL字符转义问题

我写这篇文章是因为我真的碰到了墙,无法继续前进.在我的数据库中,我已经像这样转义了HTML : "&lt;p&gt;My name is Freddy and I was".

我想将其显示为HTML或剥离我的XSL模板中的HTML标记.这两种解决方案都适合我,我会选择更快的解决方案.

我在线阅读了几篇帖子但找不到解决方案.我也尝试过disable-output-escape但没有成功.基本上似乎问题是在XSL执行中的某个地方,引擎正在将其改变&lt;p&gt;为:&amp;lt;p&amp;gt;.

它正在转化&&amp;.如果它有帮助,这是我的XSL代码.我在顶部尝试了几种带有和不带输出标签的组合.

任何帮助将不胜感激.提前致谢.

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <xsl:output method="html" omit-xml-declaration="yes"/>

  <xsl:template match="DocumentElement">
    <div>
      <xsl:attribute name="id">mySlides</xsl:attribute>
      <xsl:apply-templates>
        <xsl:with-param name="templatenumber" select="0"/>
      </xsl:apply-templates>
    </div>

    <div>
      <xsl:attribute name="id">myController</xsl:attribute>
      <xsl:apply-templates>
        <xsl:with-param name="templatenumber" select="1"/>
      </xsl:apply-templates>
    </div>
  </xsl:template>

  <xsl:template match="DocumentElement/QueryResults">
    <xsl:param name="templatenumber">tobereplace</xsl:param>

    <xsl:if test="$templatenumber=0">
      <div>
        <xsl:attribute name="id">myController</xsl:attribute>
        <div>
          <xsl:attribute name="class">article</xsl:attribute>
          <h2>
            <a>
              <xsl:attribute name="class">title</xsl:attribute>
              <xsl:attribute name="title"><xsl:value-of select="Title"/></xsl:attribute>
              <xsl:attribute name="href">/stories/stories-details/articletype/articleview/articleid/<xsl:value-of select="ArticleId"/>/<xsl:value-of select="SEOTitle"/>.aspx</xsl:attribute>
              <xsl:value-of select="Title"/>
            </a>
          </h2>
          <div> …
Run Code Online (Sandbox Code Playgroud)

html xslt escaping

8
推荐指数
2
解决办法
3万
查看次数

标签 统计

xslt ×2

escaping ×1

html ×1

javascript ×1

xml ×1