This is not a bug. This surprising behaviour is caused by:

---
collapsed: yes;
---

and:

---
xpath("if(classref/attribute::select, 'X', '-')")
---

In future versions of XXE, replacing:

---
xpath("if(classref/attribute::select, 'X', '-')")
---

by:

---
label(xpath, "if(classref/attribute::select, 'X', '-')")
---

will solve the problem.

The explanations can be found in the documentation, but also in the 
following excerpt of the changes.html document:

---
* In CSS style sheets, generated content can now contain ``proprietary'' 
extension xpath(string_specifying_an_XPath_expression) which is a 
generalization of standard construct attr(attribute_name).

The improved rendering of the DocBook xref element is implemented using 
xpath().

Note that xpath(), like attr(), is evaluated once and this happens when 
the view of the element is built. This means that in most cases, 
manually refreshing the view of the element after a change in the 
document will be needed (use Select|Redraw or Ctrl-L).

Specifying attr(foo) in a CSS rule implicitly creates a dependency 
between the value of attribute foo and the element which is the target 
of the CSS rule: the view of the element is automatically rebuilt when 
the value of its attribute foo is changed.

Similarly, specifying xpath(whatever) in a CSS rule implicitly creates a 
dependency between the element which is the target of the CSS rule and 
all its attributes: the view of the element is automatically rebuilt 
when the value of any of its attributes is changed (which too much or 
not enough depending on the value of the whatever XPath expression!).

* The xpath() construct is efficient and sometimes -- not often -- 
useful, but in many cases, it is not dynamic enough. Having to manually 
refresh the view of the element after a change in the document is 
definitely not desirable.

Unlike xpath(), new generated content object label(xpath, 
string_specifying_an_XPath_expression) is automatically updated when the 
document is modified (for efficiency reasons, the update is delayed 
until the editing context changes).

Unfortunately, label(xpath, string_specifying_an_XPath_expression) is 
not implemented in XXE V2.6 and is not expected before V2.8. XXE V2.6 
only supports label(attribute, attribute_name).
---




Manuel Collado wrote:
> Using XXE-std-2.6. The attached stripped-down sample shows a (probably) 
> unexpected behaviour:
> 
> - Open sample.xml in XXE
> - Expand any ext element
> - Toggle the checkbox
> 
> The attribute is set/unset, and the element gets collapsed!
> 
> I think this is not the expected behaviour. Apparentlty after 
> inserting/deleting the attribute the layout is recomputed, and the 
> initial requested collapsed state is restored. Probably the regular user 
> expect the display to be updated, but not restored to the initial state, 
> like just after open the file.
> 
> Regards,
> 
> 
> ------------------------------------------------------------------------
> 
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <!DOCTYPE assoc SYSTEM "sample.dtd">
> <?xml-stylesheet type="text/css" href="sample.css"?>
> <assoc>
>   <ext>
>     <name>.faq</name>
>     <classref classid="txtfile" />
>   </ext>
>   <ext>
>     <name>.log</name>
>     <classref classid="txtfile" select="yes" />
>   </ext>
>   <ext>
>     <name>.scp</name>
>     <classref classid="txtfile" />
>   </ext>
>   <ext>
>     <name>.txt</name>
>     <classref classid="txtfile" />
>   </ext>
> </assoc>
> 
> ------------------------------------------------------------------------
> 
> /*---- general ----*/
> * {
>     font-family: monospace;
> }
> *:before {
>     white-space: pre;
> }
> 
> /*---- assoc ----*/
> assoc {
>     display: block;
> }
> 
> /*---- ext ----*/
> ext:before {
>     color: #0000ff;
>     content: collapser() " "
>              xpath("if(classref/attribute::select, 'X', '-')") " Ext: ";
> }
> ext > name {
>     display: inline;
> }
> 
> ext {
>     display: block;
>     collapsible: yes;
>     collapsed: yes;
>     not-collapsible-head: 1;
> }
> 
> /*---- classref ----*/
> classref {
>     display: block;
>     content: "    "
>              check-box(attribute, select,
>                        checked-value, "yes",
>                        remove-value, yes)
>              xpath("if(id(@classid), id(@classid)/name, @classid)")
>              set-attribute-button( attribute, classid );
> }
> 
> ------------------------------------------------------------------------
> 
> <?xml version="1.0" encoding="ISO-8859-1"?>
> 
> <!ELEMENT assoc ( ext* ) >
> <!ELEMENT ext ( name, classref* )>
> <!ELEMENT classref EMPTY >
> <!ATTLIST classref select ( yes | no ) #IMPLIED
>                    classid IDREF #IMPLIED >
> <!ELEMENT name ( #PCDATA )>
> 
> ------------------------------------------------------------------------


Reply via email to