Kevin Flynn wrote:
> 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.
Let's forget about the "transform" command and let's rather concentrate
on a clean solution for your display problem.
> 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.
>
> 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.
The idea is to create a dependency between the way the root element is
rendered on screen and the value of this attribute (let's call the root
element "root" and this attribute "mode").
---
root[mode] {
background-color: white;
}
---
The above rule is not useful but it tells XXE that the rendering of root
element "root" depends on attribute "mode".
The following rules change the way element "bar", a descendant of root
element "root", is displayed, depending on the value of attribute "mode"
of root element "root".
---
root[mode=normal] bar {
background-color: #ffe4c4;
}
root[mode=special] bar {
content: "*";
background-color: #409040;
color: black;
}
---