[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]
Subject: Re: DOCBOOK-APPS: Q & A TOC missing literal elements
Bob, <sigh>It looks like I'm going to have to learn more about XSL...</sigh> Thanks very much for your explanation. It's not what I wanted to hear, but "C'est la vie!". --- Vladimir Vladimir G. Ivanovic http://leonora.org/~vladimir 2770 Cowper St. vladimir@acm.org Palo Alto, CA 94306-2447 +1 650 678 8014 "BS" == Bob Stayton <bobs@caldera.com> writes: >> 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? BS> It is not something you are doing wrong. The TOC entries for BS> Q&A will only produce plain text, based on the way the XSL stylesheet BS> is currently written. If you want the details, BS> here is the relevant template in html/qandaset.xsl: BS> <xsl:template match="question" mode="qandatoc.mode"> BS> <xsl:variable name="firstch" select="(*[name(.)!='label'])[1]"/> BS> <dt> BS> <xsl:apply-templates select="." mode="label.markup"/> BS> <xsl:text> </xsl:text> BS> <a> BS> <xsl:attribute name="href"> BS> <xsl:call-template name="href.target"/> BS> </xsl:attribute> BS> <xsl:value-of select="$firstch"/> BS> </a> BS> [stuff deleted] BS> This lines sets the variable 'firstch': BS> <xsl:variable name="firstch" select="(*[name(.)!='label'])[1]"/> BS> The XPath expression selects the first child node of BS> <question> that is not a <label> element. In your example, BS> this is the <para> element inside your <question>. BS> Further down when it is forming the <a> link, the text it BS> uses is produced using: BS> <xsl:value-of select="$firstch"/> BS> When you use <xsl:value-of> on a node, it just outputs the BS> text of the node and its children, so all element markup is BS> lost. BS> Since I didn't write the stylesheet, I can only speculate BS> that this was done to simplify processing. A <question> BS> element can contain any number of DocBook elements, and the BS> TOC processing would have to handle those elements BS> in the TOC context. If instead of using <xsl:value-of> BS> you were to use <xsl:apply-templates>, you'd be putting a <para> BS> as well as a <literal> in your TOC, or else the stylesheet would BS> have to disable <para> and many other elements when in TOC BS> mode to prevent that. BS> A <qandaentry> doesn't permit a <title> to put in BS> the TOC, so this method simplies dealing with BS> the range of possible elements that might BS> appear in a question. BS> bobs BS> Bob Stayton 400 Encinal Street BS> Publications Architect Santa Cruz, CA 95060 BS> Technical Publications voice: (831) 427-7796 BS> Caldera International, Inc. fax: (831) 429-1887 BS> email: bobs@caldera.com BS> ---------------------------------------------------------------- BS> To subscribe or unsubscribe from this elist use the subscription BS> manager: <http://lists.oasis-open.org/ob/adm.pl>
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]
Powered by eList eXpress LLC