[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]
Subject: Re: DOCBOOK-APPS: Q & A TOC missing literal elements
> From: Vladimir G Ivanovic <vladimir@acm.org> > > The <literal> elements in my <question> elements are not passed through > to the Q & A's table of contents. Is there something I'm not doing that > should be? It is not something you are doing wrong. The TOC entries for Q&A will only produce plain text, based on the way the XSL stylesheet is currently written. If you want the details, here is the relevant template in html/qandaset.xsl: <xsl:template match="question" mode="qandatoc.mode"> <xsl:variable name="firstch" select="(*[name(.)!='label'])[1]"/> <dt> <xsl:apply-templates select="." mode="label.markup"/> <xsl:text> </xsl:text> <a> <xsl:attribute name="href"> <xsl:call-template name="href.target"/> </xsl:attribute> <xsl:value-of select="$firstch"/> </a> [stuff deleted] This lines sets the variable 'firstch': <xsl:variable name="firstch" select="(*[name(.)!='label'])[1]"/> The XPath expression selects the first child node of <question> that is not a <label> element. In your example, this is the <para> element inside your <question>. Further down when it is forming the <a> link, the text it uses is produced using: <xsl:value-of select="$firstch"/> When you use <xsl:value-of> on a node, it just outputs the text of the node and its children, so all element markup is lost. Since I didn't write the stylesheet, I can only speculate that this was done to simplify processing. A <question> element can contain any number of DocBook elements, and the TOC processing would have to handle those elements in the TOC context. If instead of using <xsl:value-of> you were to use <xsl:apply-templates>, you'd be putting a <para> as well as a <literal> in your TOC, or else the stylesheet would have to disable <para> and many other elements when in TOC mode to prevent that. A <qandaentry> doesn't permit a <title> to put in the TOC, so this method simplies dealing with the range of possible elements that might appear in a question. bobs Bob Stayton 400 Encinal Street Publications Architect Santa Cruz, CA 95060 Technical Publications voice: (831) 427-7796 Caldera International, Inc. fax: (831) 429-1887 email: bobs@caldera.com
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]
Powered by eList eXpress LLC