views:

91

answers:

2

Using xslt i want to create an attribute:

<span class="tooltip">
            <xsl:attribute name="onmouseover">
                <xsl:text>javascript:function(</xsl:text>
                <span class="label">Aggiunta</span> 
                <xsl:apply-tempaltes/>
                <xsl:text>)</xsl:text>
            </xsl:attribute>

The problem is that only the pure text is putted inside the attribute, like

<span class="tooltip" onmouseover="javascript:function(Aggiunta ...)">

whithout the span tags or the tags that may come from apply-templates.

So how can I put html code into an attribute?

A: 
Dormilich
+1  A: 

If you're trying to produce correct xhtml, you really shouldn't do this at all, but make your attribute value reference a simpler javascript not containing these characters.

The rules defining well-formed XML explicitly forbid attribute values from containing the '<' character. See the W3C Recommendation.

Don Roby