[英]How can I preserve white spaces between tags with Diazo?
I'm creating a simple Diazo theme. 我正在创建一个简单的重氮主题。
The rules.xml
is something like this: 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>
And in a content file, there's the following lines: 在内容文件中,包含以下几行:
...
<div id="form-1">
<form action="...">
<input type="text" id="name" />
<input type="submit" value="ok" />
</form>
</div>
....
I expected that these lines were replicated exactly in the same way in the output html. 我希望这些行在输出html中的复制方式完全相同。 However, they became like this: 但是,他们变成了这样:
<div id="form-1">
<form action="...">
<input type="text" id="name" /><input type="submit" value="ok" /></form>
</div>
That is, every time I have an empty html tag, like <input ... />
or <br />
, the white space between it and the next tag is removed. 也就是说,每次我有一个空的html标记(如<input ... />
或<br />
,它与下一个标记之间的空白都将被删除。
I've tried to modify this behaviour using <xsl:output>
and <xsl:preserve-space>
options, without success. 我尝试使用<xsl:output>
和<xsl:preserve-space>
选项修改此行为,但没有成功。
What can I do? 我能做什么?
I'm facing this same issue. 我正面临着同样的问题。 This is a bug. 这是一个错误。
Diazo uses lxml, a Python XML library. Diazo使用lxml(Python XML库)。 lxml uses 2 C libraries, libxml2 and libxslt. lxml使用2个C库libxml2和libxslt。 This is most likely a bug in one of these 2 libraries. 这很可能是这两个库之一中的错误。
Quite possibly it is this bug: 很可能是这个错误:
https://bugzilla.gnome.org/show_bug.cgi?id=642191 https://bugzilla.gnome.org/show_bug.cgi?id=642191
The most obvious solution is to add some margin to the inputs in your CSS. 最明显的解决方案是在CSS的输入中添加一些边距。
An alternative solution to editing your css would be to re-introduce the spaces in your rules file. 编辑CSS的另一种方法是在规则文件中重新插入空格。
<replace css:content="#form-1 input">
<xsl:copy-of select="." /><xsl:value-of select="' '"/>
</replace>
This is a bit of a hack but works for me. 这有点hack,但对我有用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.