问题:< img>< / img> [英] Problem: <img></img>

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

问题描述

我的朋友有以下问题(背景:我们想通过XSLT将
XML转换为XHTML):


"我们将XHTML片段复制到使用以下模板输出:


< xsl:template match =" *" mode =" xhtml">

< xsl:element name =" {local-name()}">

< xsl:copy- of select =" @ *" />

< xsl:apply-templates mode =" xhtml" />

< / xsl:element> ;

< / xsl:template>


使用此模板,封闭元素(如< br />)现在将显示为

已打开(例如< br>< / br>)。这不像XHTML那样。


现在我们不能使用< xsl:copy-of>来复制XHTML。即使这会解决开放标签问题。这是因为XHTML根元素

声明了一个特定的命名空间,比如xy。


现在即使我们试图压制命名空间声明或者避免复制特定元素,转换过程将保持xmlns属性,因为复制的XML属于文件

包含XY名称空间声明。

所有帮助表示赞赏!

解决方案



Philipp Lenssen写道:

使用此模板,封闭元素(如< br />)现在将显示为
打开(喜欢< br>< / br>)。这不像XHTML那样。




< br />是一个空元素的标记,与< br>< / br>一样多。是。两者都是

XML(或类似XML或类似XHTML)。

-


Martin Honnen
http://JavaScript.FAQTs.com/


Martin Honnen< ma ******* @ yahoo.de>写道:

< br />是一个空元素的标记,与< br>< / br>一样多。是。
两者都是XML(或类似XML或类似XHTML)。




对于互操作性,空元素标签应为

使用,并且只应该用于声明为EMPTY的元素。

http://www.w3.org/TR/2000/REC-xml-20001006.html


文章< em ************************** ****@ram.dialup.fu-berlin.de>,

Stefan Ram< ra*@zedat.fu-berlin.de>写道:

为了实现互操作性,应该使用空元素标签,并且只应该用于声明为EMPTY的元素。



用于互操作性


[定义:标记描述不具约束力的句子

建议包括增加现有已安装的SGML处理器基础可以处理XML文档

的机会

早于ISO 8879的WebSGML Adaptations附件。]

>
http://www.w3 .org / TR / REC-xml /#dt-interop


注意应该 (而不是必须)和非约束。使用< br>< / br>是合法的

合法使用在XHTML中。


- Richard


My friend has the following problem (background: we want to transform
XML to XHTML via XSLT):

"We copy XHTML fragments into an output by using the following template:

<xsl:template match="*" mode="xhtml">
<xsl:element name="{local-name()}">
<xsl:copy-of select="@*"/>
<xsl:apply-templates mode="xhtml"/>
</xsl:element>
</xsl:template>

Using this template, closed elements (like <br/>) will now appear as
opened (like <br></br>). This isn''t quite XHTML-like.

Now we can''t copy the XHTML using <xsl:copy-of> even though that would
solve the open-tag problem. That''s because the XHTML root element
declares a specific namespace, say "xy".

Now even when we try to suppress the namespace declaration or avoid
copying the particular element, the transformation process will keep
the xmlns attribute, because the copied XML belongs to the document
containing the XY namespace declaration."
All help appreciated!

解决方案



Philipp Lenssen wrote:

Using this template, closed elements (like <br/>) will now appear as
opened (like <br></br>). This isn''t quite XHTML-like.



<br/> is markup for an empty element as much as <br></br> is. Both is
XML (or XML-like or that way XHTML-like).
--

Martin Honnen
http://JavaScript.FAQTs.com/


Martin Honnen <ma*******@yahoo.de> writes:

<br/> is markup for an empty element as much as <br></br> is.
Both is XML (or XML-like or that way XHTML-like).



For interoperability, the empty-element tag should be
used, and should only be used, for elements which are
declared EMPTY.

http://www.w3.org/TR/2000/REC-xml-20001006.html


In article <em******************************@ram.dialup.fu-berlin.de>,
Stefan Ram <ra*@zedat.fu-berlin.de> wrote:

For interoperability, the empty-element tag should be
used, and should only be used, for elements which are
declared EMPTY.



for interoperability

[Definition: Marks a sentence describing a non-binding
recommendation included to increase the chances that XML documents
can be processed by the existing installed base of SGML processors
which predate the WebSGML Adaptations Annex to ISO 8879.]

(http://www.w3.org/TR/REC-xml/#dt-interop)

Note "should" (rather than "must") and "non-binding". It''s perfectly
legal to use <br></br> in XHTML.

-- Richard


这篇关于问题:&lt; img&gt;&lt; / img&gt;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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