简体   繁体   English

如何将 HTML/XHTML 存储在 XML 文件中,然后使用 XSLT 检索它?

[英]How do I store HTML/XHTML in an XML file and then use XSLT to retrieve it?

I have an xml file containing the documentation from a project of mine.我有一个 xml 文件,其中包含我的一个项目的文档。 I'm using XSLT to transform this XML file into HTML to output it in a browser.我正在使用 XSLT 将此 XML 文件转换为 HTML 以在浏览器中输出它。

Now the thing is that I have some entities that contain some html code.现在的问题是我有一些包含一些 html 代码的实体。 Nothing complicated, just some `没什么复杂的,只是一些`
tags.标签。 But I don't seem to be able to make it work.但我似乎无法让它发挥作用。 I have tried "disable-output-escape" but it only works in internet explorer.我尝试过“禁用输出转义”,但它仅适用于 Internet Explorer。

Now I'm trying with namespaces.现在我正在尝试使用命名空间。 I wrote this in my root tag.我在我的根标签中写了这个。

xmlns:h="http://www.w3.org/1999/xhtml"

and then changed my <br/> tags to <h:br/> , but now the tags don't appear and I still don't have the line break.然后将我的<br/>标签更改为<h:br/> ,但现在标签没有出现,我仍然没有换行符。

I assume I'm missing something.我想我错过了一些东西。

Found my mistake.发现我的错误。 Had to use copy-of instead of value-of.不得不使用 copy-of 而不是 value-of。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM