Hi Nicolas,

unfortunately I cannot address your problem in full, but still hope to point to the right direction...

The source of your problem is that in fact you do not need a string with special characters in your output, but rather you need an XML element named "inline" if the "fo" namespace... And you make a string, and so get a properly formatted XML string...

What you need is to return an instance of org.w3c.dom.DocumentFragment, see http://xml.apache.org/xalan-j/extensions.html#ext-func-retval .

And unfortunately I can provide no more guidance for you from that point...

Kind regards and good luck,
Sergey


On 28.06.13 15:23, Nicolas Dubien wrote:
Hi,

I would like to know how I can use Xalan-Java extensions to compute data and return special chars like <, >.. without being escaped.

Actually, I'm using the following xsl instruction in my xsl file:
<xsl:value-of select="xalanexample:addcolor(@first)"/>

I would like a return like:
<fo:inline color="red">David</fo:inline>
But instead of that, the return is:
&lt;fo:inline color="red"&gt;David&lt;/fo:inline&gt;

My Java extension is:
public String addcolor(String name) {
        String result = ((name.compareTo("David") == 0) ? "<fo:inline color=\"red\">" : "<fo:inline color=\"blue\">") + name + "</fo:inline>";
        return result;
}


How could I do?

I am looking forward to hearing from you,
Nicolas DUBIEN