XSL直接在docbook中编写html代码
我是 docbook 的新手,但找不到直接在 docbook xml 结构中编写一些 html 代码的好方法。我能找到的最好的是 dbhtml-include,但它需要一个单独的 html 文件来解析。
可以直接写几行html吗?
我实际上想做的是在 docbook 中使用 mathjax 编写数学。不过,可能有一种更聪明的方法来做到这一点。
感谢您的任何帮助。
I am new to docbook, but can not find a decent way to write some pieces of html code directly in the docbook xml structure. The best I could find was dbhtml-include, but it requires a separate html file to parse.
Is it possible to write a few html lines directly ?
What I am actually trying to do is to write math with mathjax inside docbook. There may be a smarter way to do this though.
Thanks for any help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
始终可以在 XSLT 中“直接编写”,并且您可以修改任何 XSLT 样式表(包括 DocBook 的样式表)来执行此操作。下面是一个简单的示例:
但是,交叉解析 XSLT 和 html 是一种反模式,它会导致类似意大利面条的代码不可读且难以维护。
这解释了 Norm Walsh 对
dbhtml-include
的设计决策。一个非常强大的设计模式也是有一个类似表单的 html,其中包含一些 XML 元素,这些元素在转换后被特定内容替换 - 填空模式。
It is always possible "to write directly" in XSLT and you can modify any XSLT stylesheet, including those of DocBook, to do so. A simple example below:
However, intersparsing XSLT and html is an antipattern that leads od spaghetti-like code that is unreadable and difficult to maintain.
This explains the design decision of Norm Walsh for
dbhtml-include
.A very powerful design pattern also is to have a form-like html that contains a few XML elements which after the transformation are substituted with specific content -- the fill-in-the-blanks pattern.
FWIW,我通常只是生成一个准系统 HTML 页面,然后使用 Sitemesh 之类的东西对其进行自定义。从 XML 出发 -> XSL->完全定制的 HTML 通常是一种巨大的痛苦,除非您是弄清楚人类所见过的一些最复杂的 XSLT 样式表的大师。
FWIW, I usually just generate a barebones HTML page and then customize it with something like Sitemesh. Going from XML -> XSL -> Fully Customized HTML is generally a royal pain unless you are a master of figuring out some of the most complex XSLT stylesheets humanity has ever seen.
一些建议;
如果您有 XML 和 XSL,您可以通过 XEP 轻松生成 HTML。我觉得太有用了。如果有任何疑问,您可以访问RenderX论坛:http://cooltools.renderx.com
您也可以从 (http://www.renderx.com/tools/index.html) 尝试 XEP 的试用版
some advice;
If you have a XML and XSL, you can easily generate HTML by XEP. I think it is too usefull. If have any questions, you can visit the forum of RenderX: http://cooltools.renderx.com
Also you can try a trial version of XEP from (http://www.renderx.com/tools/index.html)