加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

xml – XSLT为什么是 出现在我的hrefs?

发布时间:2020-12-16 07:43:53 所属栏目:百科 来源:网络整理
导读:我有以下XSLT xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl" xsl:output method="html" omit-xml-declaration="yes" / xsl:strip-space e
我有以下XSLT
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"    xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl">
    <xsl:output method="html" omit-xml-declaration="yes" />
    <xsl:strip-space elements="*"/>
    <xsl:template match="@* | node()">
        <xsl:copy>

          <html>
            <body>
            <xsl:for-each select="AdvReqIMailMsg">

              <a><xsl:attribute name="href">
                  http://<xsl:value-of select="BackSideUrl"/>/customerlogin.asp?P=<xsl:value-of select="DynaCalPath"/></xsl:attribute >
                Login to View History of This Request
              </a>
              <br/>
            </xsl:for-each>
            </body>
          </html>
        </xsl:copy>
    </xsl:template>
</xsl:stylesheet>

结果如下:

<a href="&#xA;                  http://dotnet.dynacal.com/customerlogin.asp?P=DEMO8">
                Login to View History of This Request
              </a>

为什么& #xA;那里的所有空间?我是XSLT的新手,我的谷歌搜索没有改变我理解的东西.
谢谢,
肖恩

只需使用:
<a href="http://{BackSideUrl}/customerlogin.asp?P={DynaCalPath}">
           Login to View History of This Request
</a>

这(使用AVT – 属性 – 值 – 模板)更短,更易读.

几乎所有答案中都解释了报告行为的原因是属性href的值(部分)来自包含NL字符的文本节点.

这些问题是由纯粹的人类心理现象引起的:我们清楚地看到NL只要它被非白色空间包围,但是每当NL处于一个文本块的开头或结尾时我们都是NL盲.任何XSLT / XML IDE都可以在请求组中显示特殊的“不可见”字符,例如NL和CR.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读