[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [docbook-apps] How to transform the content of a <para> element ?
Hi,
While Maxime's example will indeed process all the
text node descendants of a para, it will string them together without any
emphasis markup (but with translated characters), and then the content will be
repeated because the xsl:apply-templates follows in the template.
In general it is difficult to construct a template
for a mixed content element like para that processes the text in both text
nodes and child elements while retaining the properties of the child
elements. Taking string values of the child elements loses the
element markup.
Instead, I would suggest you create a template that handles the text node descendants of para and not customize the template for para at all. Something like this: <xsl:template match="d:para//text()">
<xsl:value-of select="translate(.,'T','Z')" /> </xsl:template> Instead of matching on d:para, this template matches on any text() node
descendant of d:para (note the double slash). Since the template is only
acting on text, you don't have to worry about converting child elements to
text. So the only action the template has to take it to
translate the characters in the current text node. This will preserve the
emphasis element markup, and reach down as deeply into the text node descendants
as is needed.
|
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]