列表中的xml计数元素在Firefox中不起作用 [英] xml counting elements in a list does not work in firefox
问题描述
我编写一些CSS来自定义XML文档的显示。基本上我想自定义子元素的显示,并渲染它们类似于HTML OL / UL / LI元素。
I am writing some CSS to customise the display of an XML document. Basically I want to customise the display of child elements, and render them similar to HTML OL/UL/LI elements.
我的XML的结构如下:
My XML is structured like this:
<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="style.css"?>
<transcription>
<turn>
<speaker>Speaker Name</speaker>
<clause>
text here
</clause>
<clause>
one or more clauses
</clause>
</turn>
</transcription>
我的CSS看起来像这样:
My CSS looks like this:
turn {
counter-reset: item;
}
turn clause {
display:list-item;
}
clause {
content: counter(item);
counter-increment: item;
}
我使用这个网站: http://www.xml.com/lpt/a/401 ,并且基本上有一个类似的文档 http://www.xml.com/2000/03/29/tutorial/examples/display1 .xml ,问题是display1.xml在firefox中不工作。我可以在IE,Safari,Chrome等工作。
I am using this site: http://www.xml.com/lpt/a/401 and basically have a similar document http://www.xml.com/2000/03/29/tutorial/examples/display1.xml, the problem is that the display1.xml does not work in firefox. I do get it working in IE, Safari, Chrome etc.
任何人都可以提供一个链接,或者在firefox,以及其他浏览器工作的sultion? / p>
Can any provide a link, or sultion that would work in firefox, as well as the other browsers?
推荐答案
看起来像firefox实现display:list-item属性的方式有一些错误,计数器值。我相信这产生了在Firefox中显示的零,但不是在chrome。
It looks like there is some bug in the way that firefox implements the display: list-item property, specifically the passing of the counter value. I believe this gives rise to the zeros which show in firefox, but not in chrome.
我的解决方法是忘记使用'display:list-item' 显示为列表
My workaround is to forget about using 'display: list-item' and instead style the items directly so they appear as a list:
transcription {
counter-reset: item;
}
clause {
display:block;
margin-left:40px;
}
clause:before {
counter-increment: item;
content: counter(item) ". ";
}
这适用于以下XML:
<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="style2.css"?>
<transcription>
<turn>
<speaker>Speaker Name</speaker>
<clause>
text here
</clause>
<clause>
text here
</clause>
<clause>
text here
</clause>
</turn>
让我知道on ...
let me know how you get on...
AL
这篇关于列表中的xml计数元素在Firefox中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!