XSL用于递归转换 [英] XSL for recursive transformation

查看:81
本文介绍了XSL用于递归转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个带有自定义标签的XHTML输入文件,它指定了html

要包含的片段

例如:

< html>

....

< include frag1 =" frag1.html" frag2 =" frag2.html">

这里有更多的HTML

< / include>

.... html ...

< include frag1 =" frag3.html" ....> ...


< / html>

include标签可以嵌套。 include标签的内容将是

与片段[frag1.html和frag2.html]相结合,以生成

输出xml,它将替换当前处理的include标签。

之后,必须检查整个输出的有效XML。继续

流程,直到没有更多的包含标签。


我想知道最好的方法。 XSL

适合吗?如果是这样的话?


谢谢

Indy

Hi,
I have a XHTML input file with custom tag which specifies html
fragments to include
For example:
<html>
....
<include frag1="frag1.html" frag2="frag2.html">
More html here
</include>
....html...
<include frag1="frag3.html" ....>...

</html>
The include tag can be nested. The contents of an include tag would be
combined with the fragments [frag1.html and frag2.html] to produce the
output xml which would replace the currently processed include tag.
After that the whole output has to be checked for valid XML. And the
process is continued until there are no more include tags.

I was wondering about the best way to go about doing this. Is XSL
suitable? If so how?

Thanks
Indy

推荐答案

Indy写道:
我想知道最好的方法。 XSL是否合适?如果是这样的话?
I was wondering about the best way to go about doing this. Is XSL
suitable? If so how?




鉴于XHTML是一种XML语言,使用XInclude标签的*对*方法将是

。假设你的XHTML处理器支持XInclude,当然是



如果它不是 - 是的,你可以实现XInclude,或类似的

功能,如果你愿意,可以在XSLT中使用。其中一个实现可以是 http://www.dpawson.co.uk/xsl/sect2/include.html


(总是值得检查Dave Pawson的XSLT常见问题网站。他已经完成了从XSLT

用户的邮件列表中收集许多最佳答案的非常好的工作。顺便说一下如果

你正在寻找对样式表的更深入理解,也值得订阅。)

-

()ASCII Ribbon活动| Joe Kesselman

/ \标记HTML电子邮件! |系统architexture和动态诗歌



Given that XHTML is an XML language, the *right* way to do this would be
to use XInclude tags. Assuming your XHTML processor supports XInclude,
of course.

If it doesn''t -- yes, you can implement XInclude, or similar
functionality, in XSLT if you want to. One such implementation can be
seen at http://www.dpawson.co.uk/xsl/sect2/include.html

(It''s always worth checking Dave Pawson''s XSLT FAQ website. He''s done a
very good job of collecting many of the best answers from the XSLT
user''s mailing list. Which, by the way, is also worth subscribing to if
you''re looking for a deeper understanding of stylesheets.)
--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry


Joe Kesselman写道:
Joe Kesselman wrote:
Indy写道:
Indy wrote:
我想知道关于这样做的最佳方式。 XSL是否合适?如果是这样的话?
I was wondering about the best way to go about doing this. Is XSL
suitable? If so how?



鉴于XHTML是一种XML语言,使用XInclude标签的*正确*方法将是
。假设你的XHTML处理器支持XInclude,当然。


Given that XHTML is an XML language, the *right* way to do this would be
to use XInclude tags. Assuming your XHTML processor supports XInclude,
of course.



FWIW,Apache的mod_transform是支持XInclude的XSLT过滤器

(基于libxml2 / libxslt)。所以这是网上解决的问题。


但是,XSLT不是一个很好的解决方案,除了小的

文件。包含可以流式传输,因此使用基于SAX的解析器可以非常快地使用
和更高的可扩展性。 mod_publisher将

是一个更好的选择。


-

Nick Kew



FWIW, mod_transform for Apache is an XSLT filter that supports XInclude
(based on libxml2/libxslt). So it''s a solved problem on the Web.

However, XSLT is not a good solution to this, except for small
documents. Inclusion can be streamed, so it''ll be hugely faster
and more scalable using a SAX-based parser. mod_publisher would
be a better choice.

--
Nick Kew

Indy写道:

我有一个带有自定义标签的XHTML输入文件,它指定要包含的html
片段
例如:
< html>
...
< include frag1 =" frag1.html" frag2 =" frag2.html">
此处更多HTML
< / include>
... html ...
< include frag1 =" frag3。 HTML" ....> ...

< / html>
include标签可以嵌套。 include标签的内容将与片段[frag1.html和frag2.html]结合使用,以生成
输出xml,它将替换当前处理的include标签。
之后必须检查整个输出的有效XML。
过程一直持续到没有更多的包含标签。

我想知道最好的方法。
Hi,
I have a XHTML input file with custom tag which specifies html
fragments to include
For example:
<html>
...
<include frag1="frag1.html" frag2="frag2.html">
More html here
</include>
...html...
<include frag1="frag3.html" ....>...

</html>
The include tag can be nested. The contents of an include tag would be
combined with the fragments [frag1.html and frag2.html] to produce the
output xml which would replace the currently processed include tag.
After that the whole output has to be checked for valid XML. And the
process is continued until there are no more include tags.

I was wondering about the best way to go about doing this.




为什么不只是使用实体声明?


/// Peter

-

XML常见问题: http://xml.silmaril.ie/


这篇关于XSL用于递归转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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