Answering between lines

On 8/29/06, Hussein Shafie <hussein at xmlmind.com> wrote:
> 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.
>

No, I don't because lswe:architecture is a sibling of section, not a
child of it, so I expect it to be numbered following the section
numbering, that is: 2. lswe_architecture's title, because it flows
_after_ its sibling section numbered 1. Section_Title, and not _below_
it.

> ---
> 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).

Yes, I know that, I've read the docs. However, the 'rank' of this
occurrence of lswe:architecture within its parent is comparable
(equal) to that of its sibling section, so it shouldn't be numbered 1
like if it was a child of its sibling section (which is already
numbered 1), but 2 instead.

> * This CSS rule does not specify a larger font (e.g. font-size: 1.5em).
>
>

I didn't specify that because XXE should number and style it
automatically, if it worked fine...

>
> > While it should show:
> >
> > 1. Section_Title
> >
> > 2. lswe_architecture Title
> >
>
> ---
> @namespace lswe "XXX"; /*Must be declared in the CSS*/
>

the namespace is declared, I didn't include all of the CSS, sorry.

> 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
>

Ouch! Really? I thought that by declaring lswe:architecture like a DB
section (call it 'sintactic sugar', because lswe:architecture is
REALLY a DB section) XXE would consider them siblings, not parent
(section) and child (lswe:architecture).

Here you have the excerpt from the Schema definition of lswe:architecture:
----------------------------------------------------------------------------------------------------------
db.toplevel.sections =
  db.section,
  lswe.architecture.section,

....
....
....

lswe.architecture.section=
  [ r:remap [ db:section [ ] ] ]
  element lswe:architecture {
    db.architecture.userlevel.attribute,
    db.title,
    db.recursive.blocks.or.sections
  }
----------------------------------------------------------------------------------------------------------

Hope this helps clarify the 'bug'.

-- 
Fabian Mandelbaum
IS Engineer

Reply via email to