Hi Peter,

I believe what you are looking for is the mode="class.value" feature of the DocBook XSL stylesheets.  That mode generates each class attribute, and can be customized without needing to customize the element's main template.  It is described here:

http://www.sagehill.net/docbookxsl/HtmlCustomEx.html#CustomClassValues

Let me know if this isn't sufficient for your needs.

Bob Stayton
b...@sagehill.net

On 2/24/2020 8:13 PM, Peter Desjardins wrote:
I'm trying to design a set of elements that I can render as a single
code example with multiple programming language variants. I'd like to
style this in HTML so that the example selectively hides all but one
example variant.

I need to pass some indication of the programming language to the
output HTML so that the styling can select one or another variant. For
example, a <div class="informalexample java"> element could be
distinguished from a <div class="informalexample python"> element.

The elements I'm using so far:

- example
     - title
     - informalexample
         @role = java
         - programlisting
         - calloutlist
     - informalexample
         @role = python
         - programlisting
         - calloutlist

By default, the role attributes on the informalexample elements are
not passed through to the div elements for the informalexamples.

I could customize the template for informalexample to do what I need,
but I'm wondering if there's a build-in way to do this.

Has anyone found a good way to present multiple variants of an example
and offer readers a choice in the output presentation?

Thanks!

Peter

---------------------------------------------------------------------
To unsubscribe, e-mail: docbook-apps-unsubscr...@lists.oasis-open.org
For additional commands, e-mail: docbook-apps-h...@lists.oasis-open.org


Reply via email to