检测传入的XML“CR”字符,然后转换为
>
我在 ASP 内部使用 XSLT,它由 msxml6 提供服务。
加载到对象的传入 XML 具有“回车符”,我认为这可能是 ASCII 10。我想将它们转换为输出中的
。
我试图检测传入 XML 中的
,但似乎找不到。我尝试过 Javascript(ASP 中的 JScript),但没有成功。
有趣的是,它来自 MS Excel电子表格ML。
想法:
- 它是如何在msxsm6内部的XML对象中编码的,
- 如何检测,然后替换为
?
谢谢大家,stackoverflow 太棒了!
I am using XSLT inside of ASP, it's serviced by msxml6.
Incoming XML loaded to the object has "carriage returns" which I think may be ASCII 10. I would like to transform those to <br/>
in the output.
I am trying to detect
in the incoming XML, but can't seem to find that. I've tried Javascript (JScript inside of ASP), to no avail.
It's coming from MS Excel spreadsheetML, interestingly.
Ideas on:
- how it's encoded in the XML object inside msxsm6
- how to detect, then replace with
<br/>
?
Thank you everyone, stackoverflow is great!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
来自 http://www.w3.org/TR /2008/REC-xml-20081126/#sec-line-ends
因此,可以查找
(或
)。但请注意,输入中仅包含空白的文本节点可能会也可能不会保留,具体取决于 XML 树提供程序(MSXSL XML 解析器不保留此文本节点)。当然,不保留空白,仅保留文本节点。
然后,此
text
命名模板用 XSLT 1.0 中的空br
元素替换新行:使用此输入:
输出:
From http://www.w3.org/TR/2008/REC-xml-20081126/#sec-line-ends
So, it's ok to look for
(or
). But do note that white space only text nodes from the input may or may not be preserve depending on XML tree provider (MSXSL XML parser doesn't preserve this text nodes). Not white space only text nodes are preserved, of course.
Then, this
text
named template replace new lines with emptybr
elements in XSLT 1.0:With this input:
Output:
这是我用来执行此操作的模板:
Here is a template I use to do this: