[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [docbook] Showing/Hiding QandA answers
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 bobs@sagehill.net----- 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 Hello, 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: <html> <head> <style type="text/css"> .answer {display: none;} </style> <script type="text/javascript"> function showAnswer(id) { if (document.getElementById(id).style.display=='block'){ document.getElementById(id).style.display = 'none';} else { document.getElementById(id).style.display = 'block';} } </script> </head> <body> What is on my desk? <a href='#' onclick="showAnswer('a1');">show answer</a><span class='answer' id='a1'></span> </body> </html> To get this output in docbook->HTML, I've added this to my stylesheet template: <xsl:template name="user.head.content"> <script src="myscript.js" type="text/javascript"></script> </xsl:template> 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 answers? DAVID GOSS | Technical Writer P 1.800.876.9218 x 345 | F 1.800.588.9866 dgoss@mueller-inc.com http://www.MuellerReports.com --------------------------------------------------------------------- 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]