2010-07-19 51 views
0

我正在编写一些CSS来自定义XML文档的显示。基本上我想定制子元素的显示,并将它们渲染为与HTML OL/UL/LI元素类似。列表中的xml计数元素在Firefox中不起作用

我的XML的结构是这样的:

<?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是这样的:

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等工作。

任何可以提供一个链接或sultion,可以在Firefox以及其他浏览器?

回答

1

它看起来像firefox实现display:list-item属性,特别是计数器值的传递方式有一些错误。我相信这会产生在Firefox中显示的零,但不在铬中。

我的解决办法是忘记使用“显示:列表项”,而是直接样式的项目,使他们出现作为列表:

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> 

让我知道你上车......

AL