Re: [xsl] Turning css (font-weight:bold) attributes into tags <b>

Subject: Re: [xsl] Turning css (font-weight:bold) attributes into tags <b>
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Tue, 13 Mar 2007 18:07:20 +0100
Abel Braaksma wrote:
This example template assumes $input with 'span' elements and only text therein, but it is build with expansion in mind, so it won't be too hard to make it work with nodes inside 'span'.

A little bug crawled into the stylesheet, throwing away any attributes you'd have in the $css-mapping table. Change the treewalker to the following and it's fixed:


<!-- simple treewalker template to go from flat to hierarchical -->
<xsl:template match="* | @*" mode="flat-to-hier">
<xsl:param name="text" tunnel="yes" />
<xsl:copy>
<xsl:apply-templates select="@* | following-sibling::*[1]" mode="#current"/>
<xsl:sequence select="if(following-sibling::*) then '' else $text" />
</xsl:copy>
</xsl:template>



Cheers, -- Abel

Current Thread