XSLT help

David Tardon dtardon at redhat.com
Mon Feb 22 09:43:09 UTC 2016


Hi,

On Fri, Feb 19, 2016 at 05:41:16PM -0200, Olivier Hallot wrote:
> Hi
> 
> The expression below is supposed to generate an output like <h1>, <h2>,
> ... depending on the value of $level [1]
> 
> <xsl:text disable-output-escaping="yes"><h</xsl:text>
> <xsl:value-of select="$level"/>
> <xsl:text disable-output-escaping="yes">></xsl:text>
> 
> However, per [2] the expression will not work for Nestcape 6, and indeed
> does not work on Firefox, but work in Rekonq (KHTML engine).

Eww, this is horrible... I wouldn't trust any XSLT source that suggests
to use code like this. It breaks the guarantee that the output XML is
well-formed.

Use

<xsl:element name="{concat('h',$level)}">
<!-- content here -->
</xsl:element>

instead.

D.


More information about the LibreOffice mailing list