簡體   English   中英

如何使用Diazo保留標簽之間的空白?

[英]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="'&#32;'"/>
</replace>

這有點hack,但對我有用。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM