XSLT 不允许我使用自关闭 img 和 br 标签 [英] XSLT wont allow me to use self-closing img and br tags

查看:14
本文介绍了XSLT 不允许我使用自关闭 img 和 br 标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些在 Sitecore 6 CMS 中呈现的 XSLT,但我认为这个问题不是产品特有的.

I have some XSLT that gets rendered in the Sitecore 6 CMS, but I don't think that this issue is specific to the product.

如果我有一个自动关闭的 img 或 br 标签,就像这样:

If I have a self-closing img or br tag, like so:

<br />
<img src="your.example.com" />

结果输出为:

<br>
<img src="your.example.com">

XSLT 文件的输出方式是 HTML.它应该是XML吗?我猜自闭标签不是有效的 HTML,但将其设置为 XML 会导致我的输出出现问题吗?

The output method of the XSLT file is HTML. Is it supposed to be XML? I'm guessing that self-closing tags are not valid HTML, but is setting it to XML going to cause problems in my output?

推荐答案

那很好.您选择 HTML,HTML 中允许使用
标签.选择 XML,然后你就会得到你想要的.

That is just fine. You choose HTML, and <br> tags are allowed in HTML. Choose XML and then you will have what you want.

是的,如果您想要自关闭标签,您应该使用 XML 方法.我猜你想要 XHTML 输出,而 XHTML 是一个 XML 文档.

And yes, you should use XML method if you want self-closing tags. I'm guessing you want XHTML output, and XHTML is a XML document.

这篇关于XSLT 不允许我使用自关闭 img 和 br 标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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