Sorry, I didn't copy my message to the list when I answered Kevin Flynn!
If this can be of any use, hereunder is what I suggested :
Hi, I met the same kind of need, and devised the following work-around.
Alain Pierrot
APSED
Paris, France
Le 2 janv. 07 ? 12:43, Kevin Flynn a ?crit :
> Hi,
>
> I'm one of those whose has a macro that will be broken if I upgrade to
> version 3.5.1. I don't feel I can complain too loudly after 4 or 5
> years as
> a very satisfied "freeloader", and I can probably work around the
> issue one
> way or another.
>
> I like the sound of the transform command Hussein has proposed, but
> also
> have an alternative/additional suggestion that would solve my
> problem at
> least.
>
> The homegrown DTD I use includes a conditional filtering mechanism
> similar
> to (but a little more complex than) docbook "profiling". Since the
> documents
> I create make heavy use of this mechanism, they can sometimes get
> difficult
> to edit. In order to simplify editing, therefore, I can switch between
> different "views" in which different sets of conditions are applied
> and
> irrelevant information is hidden. The current view is determined by an
> attribute of the document's root element. Ideally, changing this
> attribute
> would immediately change the view. This is not possible, however,
> because
> CSS selectors are not powerful enough. I currently get around this
> limitation by running a "process" transformation that sets a "view"
> attribute to "show" or "hide" on all conditionalized elements each
> time the
> "current-view" attribute is updated. This view attribute can then
> be used by
> XXE's CSS display mechanism to show/hide the correct elements. The
> view
> attribute is only needed for display purposes; it has no real
> function in
> the DTD.
>
You are not stuck with a process transformation :
XMLEditors commands can be used recursively to toggle (or create and
set a value to) your "view" attribute.
I use the same (inelegant but effective) way to show/hide features
reflecting, through XPath selectors, the current status of the edited
document.
Here is a snippet of .xxe which might help you :
<binding>
<keyPressed code="F8" />
<command name="toggleAllView" parameter="show"/>
</binding>
<binding>
<keyPressed code="F8" modifiers="shift"/>
<command name="toggleAllView" parameter="hide"/>
</binding>
<!-- selects all elements with attribute "view" -->
<command name="toggleAllView">
<macro trace="false">
<sequence>
<set variable="selectedElement"
expression="//*...@view][1]"/>
<command name="toggleView" parameter="%0"/>
</sequence>
</macro>
</command>
<command name="toggleView">
<macro trace="false">
<sequence>
<choice>
<sequence>
<test
expression="contains('%0','show')"/>
<command name="setViewShow"/>
</sequence>
<sequence>
<test
expression="contains('%0','hide')"/>
<command name="setViewHide"/>
</sequence>
</choice>
<sequence>
<pass>
<test
expression="$implicitElement/following::*...@view]"/>
</pass>
<set variable="selectedElement"
expression="$implicitElement/
following::*...@view][1]"/>
<command name="toggleView" parameter="%0"/>
</sequence>
</sequence>
</macro>
</command>
<!-- Commands to be customized and called for "local toggling" or
creating the attribute when implicit -->
<command name="setViewShow">
<macro trace="false">
<sequence>
<command name="putAttribute" parameter="view
show"/>
</sequence>
</macro>
</command>
<command name="setViewHide">
<macro trace="false">
<sequence>
<command name="putAttribute" parameter="view
hide"/>
</sequence>
</macro>
</command>
>
> So my particular problem would presumably be solved by a "transform"
> command, but it occurs to me that it could be more elegantly solved
> by a CSS
> extension that allowed an xpath match expression to be used as a
> selector.
> Then I could do the whole thing like this:
>
> E:matches("<complex xpath expression matching elements that are to be
> displayed>"){
> background-color: #ffe4c4;
> }
>
> E:matches("<complex xpath expression matching elements that are NOT
> to be
> displayed>"){
> content: "*";
> background-color: #409040;
> color: black;
> }
>
> And get rid of the superfluous view attribute.
>
> Just a thought...
>
> Kevin Flynn
> Birdstep Technology ASA
> Oslo, Norway
>
>