OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]

Subject: Re: [docbook] Showing/Hiding QandA answers

[redirecting this to the docbook-apps mailing list where stylesheet issues are discussed]

Hi David,
I get the general idea, I'm not completely clear on the specifics here. Can you provide a short sample of the question/answer DocBook input and what you want its HTML output to look like? Are you using any of the qanda stylesheet params, such as qanda.defaultlabel?

Bob Stayton
Sagehill Enterprises

----- Original Message ----- From: "David Goss" <dgoss@mueller-inc.com>
To: <docbook@lists.oasis-open.org>
Sent: Tuesday, January 24, 2012 9:33 AM
Subject: [docbook] Showing/Hiding QandA answers

I am trying to replace the answers of QandA sets in HTML output to hide
by default and only show when the user clicks a "show answer" link. This
is trivial to do with HTML/Javascript:

<style type="text/css">
.answer {display: none;}
<script type="text/javascript">
function showAnswer(id) {

document.getElementById(id).style.display = 'none';}
else {

document.getElementById(id).style.display = 'block';}
What is on my desk? <a href='#' onclick="showAnswer('a1');">show
answer</a><span class='answer' id='a1'></span>

To get this output in docbook->HTML, I've added this to my stylesheet
<xsl:template name="user.head.content">
<script src="myscript.js" type="text/javascript"></script>

In the docbook source, I've change the role of answer to "hidden-answer"
and change the display type for .hidden-answer to none in my CSS.

Now to get the onclick="showAnswer(a1)" part into links. The HTML output
sets an empty anchor tag with the answer's id next to it, but not around
it. This is the part where I'm stuck...

Maybe there's a better way to accomplish this using a template on

DAVID GOSS | Technical Writer
P 1.800.876.9218 x 345 | F 1.800.588.9866

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

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]