空元素匹配 [英] Empty element match

查看:79
本文介绍了空元素匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下规则,

< xsl:template match =" br">

< br />

< / xsl:template>

这应该转换所有< br />到< br />

但是,我的变压器将它全部转换为

< br>< / br>

好​​了这个看起来不像是一个问题,但我在一个

的web应用程序中使用它,微软将这个

解释为2< br />< br />


如何强制变换器不使用这样的

隐式结束标记< br /> ?

i have the following rule,
<xsl:template match="br">
<br/>
</xsl:template>
This should convert all <br/> to <br/>
but, my transformer transforms it all to
<br></br>
Ok this does not look like a problem but i use it in a
web application and microsoft interpretes this
as 2 <br/><br/>

How can i force the transformer to not use the
implicit end tag like this <br/> ?

推荐答案

Tempore 10:23:19,死于2005年7月1日星期五AD,hinc in foro {comp.text.xml} scripsit Tjerk Wolterink< ; tj *** @ wolterinkwebdesign.com>:
Tempore 10:23:19, die Friday 01 July 2005 AD, hinc in foro {comp.text.xml} scripsit Tjerk Wolterink <tj***@wolterinkwebdesign.com>:
如何强制变换器不使用
隐式结束标记,如下所示< br /> ?
How can i force the transformer to not use the
implicit end tag like this <br/> ?




将输出方法设置为''html''。


问候,

-

Joris Gillis( http:/ /users.telenet.be/root-jg/me.html

Ceterum censeo XML omnibus esse utendum



Set your output method to ''html''.

regards,
--
Joris Gillis (http://users.telenet.be/root-jg/me.html)
Ceterum censeo XML omnibus esse utendum



如何强制变换器不使用这样的
隐式结束标记< br /> ?
How can i force the transformer to not use the
implicit end tag like this <br/> ?




如果您正在编写html,那么您应该使用html输出方法

,这将输出为< br>但是,如果您在标准xslt中编写xml然后

,则无法自定义此项,尽管您的

系统可能允许您指定非标准序列化程序。


如果你将xml作为text / html发送到IE,那么它会将其解析为html和

不理解br的XML语法只是

问题..如果你用XML mime类型发送它然后它将使用xml

解析器并正确解析它,但你必须提供样式表

为了显示,因为它没有内置的xhtml支持。


David



If you are writing html then you should use the html output method
and this will be output as <br> However if you are writing xml then
within standard xslt there is no way to customise this although your
system may allow you to specify a non standard serialiser.

If you send xml to IE as text/html then it will parse it as html and
not understanding XML syntax for br is only a small part of the
problems.. If you send it with an XML mime type then it will use an xml
parser and parse it correctly, but you then have to supply a stylesheet
in order for it to display as it doesn''t have xhtml support built in.

David


Joris Gillis写道:
Joris Gillis wrote:
Tempore 10:23:19,死于公元2005年7月1日星期五,hinc in foro
{comp.text.xml} scripsit Tjerk Wolterink< tj *** @ wolterinkwebdesign .com>:
Tempore 10:23:19, die Friday 01 July 2005 AD, hinc in foro
{comp.text.xml} scripsit Tjerk Wolterink <tj***@wolterinkwebdesign.com>:
如何强制变换器不使用
隐式结束标记,如下所示< br /> ?
How can i force the transformer to not use the
implicit end tag like this <br/> ?



将输出方法设置为''html''。

问候,


Set your output method to ''html''.

regards,




它被设置为html:

< xsl:output method =" html" indent =" yes" />



it is set to html:
<xsl:output method="html" indent="yes"/>


这篇关于空元素匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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