没有在我的XSLT中添加新行 [英] not adding new line in my XSLT

查看:93
本文介绍了没有在我的XSLT中添加新行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不确定为什么我的xslt不会在输出中添加新行... 这是我的xslt....

I am not certain why my xslt won't put a new line in my output... This is my xslt....

<?xml version="1.0" encoding="utf-8"?>
<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="text" encoding="iso-8859-1"/>
  <xsl:variable name="newline"></xsl:variable>
  <xsl:template name="FairWarningTransform" match="/">    <!--@* | node()">-->

          <xsl:for-each select="//SelectFairWarningInformationResult">  

                <xsl:value-of select="ApplicationID"/>,<xsl:value-of select="USERID"/>
                &#10;
          </xsl:for-each>

        * Note.  This report outlines Fair warning entries into reported for the above time frame.

      </xsl:template>
</xsl:stylesheet>

这是我的输出...

1,TEST1,test2,

我希望它看起来像...

I want it to look like...

1,TEST
1,test2,

为什么不是这个角色 创建换行符

Why isn't this character creating a newline

推荐答案

XSLT的默认行为是忽略样式表中完全为空格的任何文本节点(即使某些空格被编码为类似于),但保留<xsl:text>中的文本.

XSLT's default behavior is to ignore any text nodes in the stylesheet that are entirely whitespace (this is true even if some of the whitespace is encoded as entities like &#10;), except for text inside <xsl:text>, which is preserved.

我建议替换这些行:

<xsl:value-of select="ApplicationID"/>,<xsl:value-of select="USERID"/>
&#10;

与此:

<xsl:value-of select="concat(ApplicationID, ',', USERID, '&#10;')"/>

这样,应确保换行符包含在输出中.

That way the newline should be ensured to be included in the output.

这篇关于没有在我的XSLT中添加新行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆