[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [docbook-apps] class.value mode with multiple values
Hi Tim,The processing model for XSLT, as stated in the standard, is "A node is processed by finding all the template rules with patterns that match the node, and choosing the best amongst them". There is an algorithm for decided which is "best", but it always comes down to one template. So the XSLT mechanism won't ever match on both of your templates.
Within the body of that single chosen template, however, you can apply other templates to the same element using these methods:
<xsl:call-template name="othertemplate"/> <xsl:apply-imports/> <xsl:apply-templates select="." mode="othermode"/>You can also use an xsl:choose within that single template to test the current element (xsl:when test="self::d:term") and add another value or call another template.
You'll need to examine the organization of your class values to see which method would work best for you.
Bob Stayton Sagehill Enterprises email@example.com From: Tim Arnold Sent: Tuesday, October 15, 2013 6:37 AM To: DocBook Apps Subject: [docbook-apps] class.value mode with multiple valueshi, I have an element that I want to have multiple class values by matching in class.value mode.
I've read this doc, but still not sure how to proceed: http://www.sagehill.net/docbookxsl/HtmlCustomEx.html Currently I have these two templates: <xsl:template match="d:term" mode="class.value"> <xsl:value-of select="'AAterm'" /> </xsl:template> <xsl:template match="d:*[@conformance='experimental']" mode="class.value"> <xsl:value-of select="local-name()" /> <xsl:value-of select="' AAexperimental'" /> </xsl:template>My DocBook source has a <term conformance="experimental">; it seems that the last template wins so this is the result:
<dt class="term AAexperimental"> but I need <dt class="AAexperimental AAterm">the attribute conformance="experimental" can appear on multiple element types, (e.g., section, term)
How to get the two templates to work together? thanks,--Tim