带有Umlaut的奇怪XSLT行为 [英] Strange XSLT Behvavior with Umlaut

查看:82
本文介绍了带有Umlaut的奇怪XSLT行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试使用XSLT解析xml中的节点中的突变时,我有一个非常奇怪的行为.

因此,现在我们假设CustomerName的值为MÖP".

在这种情况下,生成的HTML标记"a"将具有href到"M%C3%B6P"的

I have a very strange behavior when I got mutations in a node in xml when I try to parse it with an XSLT.

So we now assume that CustomerName has the Value ''MÖP''.

In this case, the resulting HTML ''a'' tag would have a href to ''M%C3%B6P''

<a href="{CustomerName}">
    <xsl:value-of disable-output-escaping="yes" select="CustomerName"/>
</a>


在这种情况下,结果HTML的"div"标记将具有IDMÖP"


In this case, the resulting HTML ''div'' tag would have an id ''MÖP''

<div style="display:none">
    <xsl:attribute name="id"><xsl:value-of select="CustomerName"/></xsl:attribute>
</div>



似乎a标签中的href属性与它有关.

我的问题是,为什么会这样?我在两种情况下都可以得到相同的输出吗?

Greetz



It seems like the attribute href in the a tag has something to do with it.

My question is, why is it like that ? An what can i do that in both cases i got the same output ?

Greetz

推荐答案

有人在另一个论坛中回答了它.这是解决方案.

XSLT处理器通过在HTML链接元素的href属性中转义URL值,从而帮了您一个忙.这是设计使然,请参阅 http://www.w3.org/TR/xslt -xquery-serialization/#HTML_ESCAPE-URI-ATTRIBUTES .如果您确实不希望使用XSLT 2.0处理器,则可以使用
Somebody answered it in another forum. Here is the solution.

The XSLT processor is doing you a favour by escaping the URL value in the href attribute of the HTML link element. This is by design, see http://www.w3.org/TR/xslt-xquery-serialization/#HTML_ESCAPE-URI-ATTRIBUTES. If you really don''t want that and you use an XSLT 2.0 processor then you can use
<xsl:ouput method="html" escape-uri-attributes="no" xmlns:xsl="#unknown" />

在您的样式表中.

在.net下开发的问题是它不支持XSLT2.0.
您必须使用Saxon.net之类的第三方XSLTProcessor

in your stylesheet.

The problem developing under .net is that it don''t supports XSLT2.0.
You have to use a third party XSLTProcessor like Saxon.net


这篇关于带有Umlaut的奇怪XSLT行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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