This is the mail archive of the
docbook@lists.oasis-open.org
mailing list for the DocBook project.
Re: FAQ: XML solution for conditonal sections
Bernd Kreimeier wrote:
> The way I read this I can use multiple attributes to implement orthogonal
> criteria like "target=internal|public" and "profile=reference|annotation|rfc",
> and I can use multiple values each single element's attribute. Is it recommended
> to use attr="val1;val2" or better to define a "val1and2"? E.g. profile="full"
> would be equivalent to "reference;annotation;rfc" and include all.
Profiling stylesheet doesn't have any special support for compounded
clasess. So using first way will bring you less troubles.
> I would also guess that per-element attributes allow for different kinds of
> filtering strategies. For example
>
> <section target="internal">
> <title>Something Public</title>
> <para target="public">
> Some public content
> </para>
> </section>
>
> can be considered
> a) an error - contained elements should not contradict the parent's settings
> b) an override - parent element defines a default, which can be overridden
> (won't work for the "public" rendering as the <section> is lost)
> c) a mistake in the design? Don't make them common attributes?
>
> Any recommendations for this? I found
> CVS docbook/xsl/tools/profile/profile.xsl
This implementation cuts whole sub-trees in XML source. So if some
element doesn't belong to target profile all its children are ignored.
> anything other examples I should look at? I'd expect that creating
> inconsistent attributes in the XML will create a broken profiled
> intermediate (e.g. title missing, empty para etc.), which will be
> detected in the second stage processing, so for user convenience it
> might be worth having consistency checking in the profiling stage?
Approach mentioned above prevents you from creating invalid markup for
99%.
Jirka
--
-----------------------------------------------------------------
Jirka Kosek
e-mail: jirka@kosek.cz
http://www.kosek.cz