[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: RE: [docbook-apps] formatting html output for qanda
Hi Diane, I don't know what unwrap.p is, but I solved the problem in a different way, using a combination of CSS and template overrides. I overrode the question and answer templates to add a <p> before the answer label and the question label so they'd line up the same. (You might adding the <p> first: I can't remember if all the css things were necessary for this particular problem, but this helps us achieve the whole "look" of the Q and A stuff.) I also made sure the alignment for the table rows were "left" and "top" as follows: TEMPLATE OVERRIDES <xsl:template match="question"> <xsl:variable name="deflabel"> <xsl:choose> <xsl:when test="ancestor-or-self::*[@defaultlabel]"> <xsl:value-of select="(ancestor-or-self::*[@defaultlabel])[last()] /@defaultlabel"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="$qanda.defaultlabel"/> </xsl:otherwise> </xsl:choose> </xsl:variable> <tr class="{name(.)}"> <td align="left" valign="top"> <xsl:call-template name="anchor"> <xsl:with-param name="node" select=".."/> <xsl:with-param name="conditional" select="0"/> </xsl:call-template> <xsl:call-template name="anchor"> <xsl:with-param name="conditional" select="0"/> </xsl:call-template> <p><b> <!-- Trish: added a paragraph so it would line up the same as question, which is put into paragraphs --> <xsl:apply-templates select="." mode="label.markup"/> <xsl:if test="$deflabel = 'number' and not(label)"> <xsl:apply-templates select="." mode="intralabel.punctuation"/> </xsl:if> </b></p> </td> <td align="left" valign="top"> <xsl:choose> <xsl:when test="$deflabel = 'none' and not(label)"> <b><xsl:apply-templates select="*[name(.) != 'label']"/></b> </xsl:when> <xsl:otherwise> <xsl:apply-templates select="*[name(.) != 'label']"/> </xsl:otherwise> </xsl:choose> </td> </tr> </xsl:template> <xsl:template match="answer"> <xsl:variable name="deflabel"> <xsl:choose> <xsl:when test="ancestor-or-self::*[@defaultlabel]"> <xsl:value-of select="(ancestor-or-self::*[@defaultlabel])[last()] /@defaultlabel"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="$qanda.defaultlabel"/> </xsl:otherwise> </xsl:choose> </xsl:variable> <tr class="{name(.)}"> <td align="left" valign="top"> <xsl:call-template name="anchor"/> <p><b> <xsl:variable name="answer.label"> <xsl:apply-templates select="." mode="label.markup"/> </xsl:variable> <xsl:copy-of select="$answer.label"/> </b></p> <!-- Trish: added a paragraph so it would line up the same as question, which is put into paragraphs --> </td> <td align="left" valign="top"> <xsl:apply-templates select="*[name(.) != 'label']"/> </td> </tr> </xsl:template> Here's the CSS we have for question and answer: CSS STUFF th.qandaset { font-weight: bold; background: white; } td.qandaset { font-size: 90%; background: white; } tr.question { background: white; } tr.question td p {margin-top: 0em; margin-bottom: 0em; padding-bottom: 0em; } tr.answer td p { margin-top: 0em; margin-bottom: 0em;padding-bottom: 0em; } tr.answer td { background: white; margin-top: 0em; padding-top: 0em; padding-bottom: 1.0em; } /*-- Adds more space between q and a pairs --*/ Hope this helps, --Trish Trish Billard trish.billard@hp.com (408) 285-5462 -----Original Message----- From: Diane Larin [mailto:diane@inro.ca] Sent: Monday, November 15, 2004 11:30 AM To: docbook-apps@lists.oasis-open.org Subject: [docbook-apps] formatting html output for qanda Hi, I would like to get rid of the line break after the qanda labels. For example: Q: Where can I find a solution to this problem? A: The answer can be found ... instead of Q: Where can I find a solution to this problem? A: The answer can be found ... I saw a message suggesting the use of unwrap.p template but I don't understand what to do exactly. I am using xsltproc with docbook-xsl-1.67.0. Diane Larin INRO
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]