Hi David,
Yes, qandaentry is handled in a special way because qandaset is output in an
HTML layout table, so each qandaentry becomes two row (tr) elements in HTML
output, one for the question and one for the answer. In each row, the label is
put in the first column and the paragraphs in the second. A table layout is
used so that the width of the first column can adjust to fit the label, which
can be long if labels are customized.
If you peek in the xhtml/qandaset.xsl, you can see that the template that
matches on "qandaentry" just does an xsl:apply-templates. The templates
matching on "question" and "answer" each create its row. So your customization
just needs to be modified a bit, so it matches on the child elements:
<xsl:template match="qandaentry[@audience='instructoronly']/*]"
mode="class.value">
<xsl:value-of select="'instructoronly'"/>
</xsl:template>
That will add the class value to the <tr> elements for the question and answer.
*But* there is one more thing that must be done. It seems that not all of the
qandaset templates have been updated to apply the template using
mode="class.value". The question template does, but the answer template does
not. I'll fix that in SVN, but for now you would need to customize the
template matching on "answer". Copy that template and change this line from:
<tr class="{local-name(.)}">
to
<tr>
<xsl:apply-templates select="." mode="class.attribute"/>
Bob Stayton
Sagehill Enterprises
[email protected]
----- Original Message -----
From: David Link
To: [email protected]
Sent: Friday, March 18, 2011 2:32 PM
Subject: [docbook-apps] qanda tags with propagate.style
Hi
Regarding qandaentry tags -- Is there a way to preserve
audience="instructoronly" information in the HTML?
Example:
<qandaentry xml:id="ball-ch01_qs01_qd01_qa02" audience="instructoronly">
<question>
<para xml:id="ball-ch01_qs01_p02">Give an example of matter in each
phase: solid, liquid, or gas.</para>
</question>
<answer>
<para xml:id="ball-ch01_qs01_p03">solid: wood; liquid: water in a
pond; gas: air in the atmosphere (answers will vary)</para>
</answer>
</qandaentry>
Explaination:
We are using audience='instructoronly' on every other qandaentry so that we
can conditionally remove them from output via styling (via styling to maintain
label numbering)
We are doing this with in prince for the pdf, and that is working fine.
But for the HTML the xhtml/docbook.xsl transforms does not propaget the
'instructoronly' as a div with class='instructoronly'
I tried
<xsl:template match="qandaentry[@audience='instructoronly']"
mode="class.value">
<xsl:value-of select="'instructoronly'"/>
</xsl:template>
But that doesn't seem to work. I believe because it is rendered into an html
table.
Can anyone suggest away to maintain the audience='instructoronly' in the HTML
?
Thank you very much.
David Link
New York