|
Subject: Re: [xsl] From WordprocessingML inline styles to nested inline elements From: Yves Forkl <Y.Forkl@xxxxxx> Date: Mon, 02 Apr 2007 14:52:22 +0200 |
<style_nesting> <b><i><u/></i></b> </style_nesting>
<w:r>
<w:rPr>
<w:i/>
<w:b/>
</w:rPr>
<w:t>This is text in bold and italic.</w:t>
</w:r>a) Using an ordered set of modes (e.g. 1 - unnamed, 2 - style_i, 3 - style_u etc.). This requires, however, a cascade of all the styles that could come next and may be active or not, established by the list of modes allowed next:
<xsl:template match="w:r[w:rPr/w:b]"> <xsl:element name="b"> <xsl:apply-templates select="." mode="style_i style_u style_x"/> </xsl:element> </xsl:template>
<xsl:template match="w:r[w:rPr/w:i]" mode="style_i"> <xsl:element name="i"> <xsl:apply-templates select="." mode="style_u style_x"/> </xsl:element> </xsl:template>
<xsl:template match="w:r">
<xsl:call-template name="add_style">
<xsl:with-param name="style_names_list"
select="('b', 'i', 'u', 'NONE')"/>
</xsl:call-template>
</xsl:template><xsl:template name="add_style"> <xsl:param name="style_names_list"/>
<xsl:variable name="current_style_name"
select="$style_names_list[1]"/> <xsl:when test="$current_style_name = 'NONE'">
<xsl:value-of select="w:t"/>
</xsl:when> <xsl:when test="w:rPr/*[local-name()=$current_style_name]">
<xsl:element name="{$current_style_name}">
<xsl:call-template name="add_style">
<xsl:with-param name="style_names_list"
select="remove($style_names_list, 1)"/>
</xsl:call-template>
</xsl:element>
</xsl:when> <xsl:otherwise>
<xsl:call-template name="add_style">
<xsl:with-param name="style_names_list"
select="remove($style_names_list, 1)"/>
</xsl:call-template>
</xsl:otherwise>$style_names_list = () $current_style_name = '' $current_style_name = ()
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| [xsl] XSL pagination question, Ray Masa | Thread | Re: [xsl] From WordprocessingML inl, Wendell Piez |
| Re: [xsl] Proposed syntax for names, Andrew Welch | Date | [xsl] xpath analyser in XSL-T 1 or , bryan rasmussen |
| Month |