Brian, You are right; I did a mistake when I tried to summarize my problem. I'm sorry for making you lose your time...
Here is a small program that shows what my problem is (see below). I think my problem has to do with TransformerHandler "chaining" (something I can difficultly escape in my program, for some reasons). Here is what it outputs: <?xml version="1.0" encoding="UTF-8"?> Yes: <a href="http://www.google.com">Google</a><hr/> No: <a href="http://www.google.com">Google</a> <?xml version="1.0" encoding="UTF-8"?> No: <a href="http://www.google.com">Google</a><hr/> Yes: <a href="http://www.google.com">Google</a> Do you know why the 1st "No" is not escaped while the 2nd "No" is escaped? Shouldn't both "No" be escaped? I hope you will have an answer for me... Thank you! Andre Powroznik ===== Bug.java ========== import java.io.File; import javax.xml.transform.sax.SAXResult; import javax.xml.transform.sax.SAXTransformerFactory; import javax.xml.transform.sax.TransformerHandler; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; import org.jdom.Element; import org.jdom.output.SAXOutputter; public class Bug { public static void main(String[] args) throws Exception { Element something = new Element("something"); something.addContent("<a href=\"http://www.google.com\">Google</a>"); SAXTransformerFactory factory = (SAXTransformerFactory) SAXTransformerFactory .newInstance(); { TransformerHandler handler1 = factory .newTransformerHandler(new StreamSource( new File("foo1.xsl"))); TransformerHandler handler2 = factory.newTransformerHandler(); handler2.setResult(new StreamResult(System.out)); handler1.setResult(new SAXResult(handler2)); new SAXOutputter(handler1).output(something); } { TransformerHandler handler1 = factory .newTransformerHandler(new StreamSource( new File("foo2.xsl"))); TransformerHandler handler2 = factory.newTransformerHandler(); handler2.setResult(new StreamResult(System.out)); handler1.setResult(new SAXResult(handler2)); new SAXOutputter(handler1).output(something); } } } ===== foo1.xls ========== <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> Yes: <xsl:value-of select="/something" disable-output-escaping="yes" /> <hr /> No: <xsl:value-of select="/something" disable-output-escaping="no" /> </xsl:template> </xsl:stylesheet> ===== foo2.xsl ========== <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> No: <xsl:value-of select="/something" disable-output-escaping="no" /> <hr /> Yes: <xsl:value-of select="/something" disable-output-escaping="yes" /> </xsl:template> </xsl:stylesheet> -----Original Message----- From: Brian Minchau [mailto:[EMAIL PROTECTED] Sent: mercredi 17 mai 2006 18:16 To: [EMAIL PROTECTED]; xalan-j-users@xml.apache.org Subject: Re: Is this a bug in disable-output-encoding? Andre, sorry but I don't see the escaping or non-escaping with your two stylesheets and the given input XML, because your sample input XML never has any escaping required. With your first stylesheet and your given XML I get this output: << <?xml version="1.0" encoding="UTF-8"?> Yes: Google <hr/> No: Google >> For the second stylesheet I get this: << <?xml version="1.0" encoding="UTF-8"?> No: Google <hr/> Yes: Google >> So I don't see where there is a chance for escaping with your testcase. So I modified your input XML to this: << <?xml version="1.0"?> <something> <a href="http://www.google.com">3 < 4</a> </something> >> Your first stylesheet then produced this: << <?xml version="1.0" encoding="UTF-8"?> No: 3 < 4 <hr/> Yes: 3 < 4 >> which is right, for the 'no' case escaping is not disabled, in other words escape, and the '<' is escaped to "<", and in the second case for 'yes' escaping is disabled and the '<' is not escaped. When run with your second stylesheet the output is: << <?xml version="1.0" encoding="UTF-8"?> Yes: 3 < 4 <hr/> No: 3 < 4 >> I don't see the bug that you are referring to. - Brian - - - - - - - - - - - - - - - - - - - - Brian Minchau XSLT Development, IBM Toronto e-mail: [EMAIL PROTECTED] [EMAIL PROTECTED] rb.be To 05/15/2006 07:50 xalan-j-users@xml.apache.org AM cc Subject Is this a bug in disable-output-encoding? Hello, I'd like to have your opinion regarding a possible bug in Xalan 2.7.0... Here are 2 stylesheets. With the first stylesheet, output is always escaped (it's not what I expect), while in the second case, output is escaped as I expect it to be. Do you know if it is normal? Thank you! Andre Powroznik Stylesheet 1: ============= <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> Yes: <xsl:value-of select="/something" disable-output-escaping="yes" /> <hr /> No: <xsl:value-of select="/something" disable-output-escaping="no" /> </xsl:template> </xsl:stylesheet> Stylesheet 2: ============= <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> No: <xsl:value-of select="/something" disable-output-escaping="no" /> <hr /> Yes: <xsl:value-of select="/something" disable-output-escaping="yes" /> </xsl:template> </xsl:stylesheet> The XML could be, for example: ============================== <?xml version="1.0"?> <something> <a href="http://www.google.com">Google</a> </something>