[英]How can I preserve white spaces between tags with Diazo?
我正在创建一个简单的重氮主题。
rules.xml
是这样的:
<?xml version="1.0" encoding="UTF-8"?>
<rules
xmlns="http://namespaces.plone.org/diazo"
xmlns:css="http://namespaces.plone.org/diazo/css"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<theme href="index.html"/>
<replace css:content="#form-1" css:theme="#form-1" />
</rules>
在内容文件中,包含以下几行:
...
<div id="form-1">
<form action="...">
<input type="text" id="name" />
<input type="submit" value="ok" />
</form>
</div>
....
我希望这些行在输出html中的复制方式完全相同。 但是,他们变成了这样:
<div id="form-1">
<form action="...">
<input type="text" id="name" /><input type="submit" value="ok" /></form>
</div>
也就是说,每次我有一个空的html标记(如<input ... />
或<br />
,它与下一个标记之间的空白都将被删除。
我尝试使用<xsl:output>
和<xsl:preserve-space>
选项修改此行为,但没有成功。
我能做什么?
我正面临着同样的问题。 这是一个错误。
Diazo使用lxml(Python XML库)。 lxml使用2个C库libxml2和libxslt。 这很可能是这两个库之一中的错误。
很可能是这个错误:
https://bugzilla.gnome.org/show_bug.cgi?id=642191
最明显的解决方案是在CSS的输入中添加一些边距。
编辑CSS的另一种方法是在规则文件中重新插入空格。
<replace css:content="#form-1 input">
<xsl:copy-of select="." /><xsl:value-of select="' '"/>
</replace>
这有点hack,但对我有用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.