[xsl] pesky & and fop

Subject: [xsl] pesky & and fop
From: "eoin walsh" <paul5@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 9 Oct 2002 17:45:45 +0100
Hi,

I'm trying to dynamically insert some special characters (bullet point for 
example - &#8226;) into a pdf produced using xsl + fop.

The XML input is built  using something like

<snip>

 String value = "&#8226";
 Node root = doc.createElement("THEBIGONE");
 Text t = doc.createTextNode(value);
 root.appendChild(t);
 
</snip>


So, I have an xml document with the node above. This is then transformed 
using xalan-2.0.0.jar with...

<snip>
 Transformer transformer = tbf.newTransformer(new StreamSource(xslfile));
 DOMResult domResult = new javax.xml.transform.dom.DOMResult();
 transformer.transform(new javax.xml.transform.dom.DOMSource
(thedoc),domResult);
 // Now you can get the output Node from the DOMResult.
 Document result = (Document) domResult.getNode();
</snip>

and sent off to the fop processor for conversion to PDF. Ok so far.

The xsl stylesheet contains

<fo:block><xsl:value-of select="THEBIGONE" disable-output-
escaping="yes"/></fo:block>

which to work properly with the fop needs to transform to

<fo:block>&#8226;</fo:block>

Unfortunately the & in the xml node gets further escaped in the 
transformation to 

<fo:block>&amp;#8226;</fo:block>
 
So in the PDF instead of a bullet point I see &amp;#8226;

As you can see I've set the disable-output-escaping="yes" attribute in the 
stylesheet. Not only have I read that this isn't really a good idea (with 
evil overtones of GOTO) but it doesn't even seem to do the trick.....

I've also played with encoding types and gludgey entity substitutions with no 
luck. Any advice/direction (even it's "it can't be done") would make work fun 
again.........

Cheers

Paul






 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread