Thank you, this explained everything but raised another question. I just
changed my code and removed the @mode. Now, the question is , why did
you use @role in your example. Why didn't you use @language ? Is there
a specific reason ? Is any of them dedicated for this kind of customization?
Keith Fahlgren wrote:
> On Feb 3, 2008 12:37 PM, Mansour <> wrote:
>
>> I am trying t use mode with programlisting to treat the contents in a
>> different way. Here's a piece of my document:
>>
>
> This isn't valid DocBook 4/5, as there's no programlisting/@mode, so
> that's the first thing to fix:
>
>
>> <example>
>> <title>webapp/WEB-INF/web.xml</title>
>> <programlisting mode="format-xml">
>> <xi:include href="files/web.xml" />
>> </programlisting>
>> </example>
>>
>
> Perhaps you want no use programlisting/@role instead of @mode?
>
>
>> Now in my customization layer I have:
>>
>> <xsl:template match="programlisting" mode="format-xml" priority="9.0">
>> <xsl:apply-templates mode="format-xml" />
>> </xsl:template>
>>
>
> So, this template is only matching programlistings in a specific [XSL]
> mode. More on xsl:template/@mode, briefly, here:
> http://www.w3schools.com/xsl/el_template.asp
>
> In this case (assuming you've noted my warning about invalid DocBook
> and changed your markup), what you actually want to do is match a very
> specific programlisting in the default xsl:template/@mode (which we're
> gunna omit, along with [probably] unnecessary @priority):
>
> <xsl:template match="programlisting[@role = 'format-xml']>
> <!-- This format-xml mode had better be defined somewhere in
> your customization. Otherwise drop. -->
> <xsl:apply-templates mode="format-xml" />
> </xsl:template>
>
>
>> But it's not matching. I changed the value of the priority.
>>
>
> @priority won't help a non-matching template. This one failed to match
> on xsl:template/@mode, but you could have been more specific in your
> xsl:template/@match (see above).
>
> HTH,
> Keith
>
>