Fabian Mandelbaum wrote:
> 
> I've noticed a bug with a custom CSS for a custom Schema based on DocBook.
> 
> Our schema customization defines a new element named lswe:architecture
> which is similar (equal actually) to DocBook's standard section
> element.
> 
> I then define the following in CSS:
> ---------------------------------------------------------------------------------------------------
> 
> lswe|architecture {
>  display: block;
>  collapsible: yes;
>  not-collapsible-head: 1;
> }
> 
> lswe|architecture > title:before
> {
>  content: collapser() " " counter(n) " ";
> }
> ---------------------------------------------------------------------------------------------------
> 
> 
> To make lswe:architecture behave like DocBook's section in terms of
> collapsibility and numbering. Collapsibility works fine; however,
> numbering doesn't.
> 
> Exceprt of the XML file:
> ---------------------------------------------------------------------------------------------------
> 
> <section>
> <title>Section_Title</title>
> ...
> </section>
> 
> <lswe:architecture>
> <title>lswe_architecture Title</title>
> ...
> </lswe:architecture>
> ---------------------------------------------------------------------------------------------------
> 
> 
> So, section and lswe:architecture are siblings. The non-styled (tree)
> view correctly shows that the siblings (section and lswe:architecture)
> are at the same level, but the styled view shows:
> 
> 1. Section_Title (fine)
> 
> 1. lswe_architecture Title (wrong) (it's even shown in a smaller type,
> like if lswe_architecture was a child of section instead of a sibling
> of it).
> 

I see no bug here. You see exactly what you have specified in CSS.

---
lswe|architecture > title:before
{
 content: collapser() " " counter(n) " ";
}
---

* counter(n) means: the rank of this occurrence of lswe:architecture
within its parent (whatever is this parent).
* This CSS rule does not specify a larger font (e.g. font-size: 1.5em).



> While it should show:
> 
> 1. Section_Title
> 
> 2. lswe_architecture Title
> 

---
@namespace lswe "XXX"; /*Must be declared in the CSS*/

lswe|architecture > title:before
{
 content: collapser() " "
          label(xpath,
            "index-of-node(../../section|../../lswe:architecture,..)")
          " ";
}
---
(Documentation of index-of-node:
http://www.xmlmind.com/xmleditor/_distrib/doc/commands/xpathextfunc.html )
(Documentation of label:
http://www.xmlmind.com/xmleditor/_distrib/doc/csssupport/label.html )

--> Label() is more powerful but far less efficient than counter().

--> Personally, I would write a CSS extension in Java[m] to solve this
kind of problem. See
http://www.xmlmind.com/xmleditor/_distrib/doc/dev/styleext.html

Reply via email to