[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] Problems with apersand (&) when trying to dynamically define a character value as an attribute value.


Subject: [xsl] Problems with apersand (&) when trying to dynamically define a character value as an attribute value.
From: "Robert Eaton" <reaton@xxxxxxxxxxxxxxx>
Date: Thu, 26 Oct 2006 12:12:34 +0100

I am trying to convert an XML document in to wordML format. When creating a
list in wordML there is an attribute that specifies the character to be used
as the bullet point; I need to set this based on an attribute in the input
XML, the value of which will be just the character code with out the &# at the
beginning e.g. x25CF.

The problem I am having is constructing the final output attribute value
which, for the above example I need to be &#x25CF;. If specifying a character
in that format is not a problem; but adding the '&#' to the beginning of the
input attribute value is proving to be very difficult.

If I try to use XSL similar to:

<xsl:template match="dummy">
             <lvlText>
                    <xsl:attribute name="val">
                           <xsl:text disable-output-escaping="yes"
>&amp;#</xsl:text>
                           <xsl:value-of select="@character"/>
                           <xsl:text
disable-output-escaping="yes">;</xsl:text>
                    </xsl:attribute>
             </lvlText>
       </xsl:template>

The output I get is

<lvlText val="&amp;#x25CF;" />

If I do not escape the & I get an error saying the file is not well formed.

Anyone know how I could get this to work. Any suggestions greatfuly received.

Thanks
Rob


Current Thread
Keywords