You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Andre Powroznik (JIRA)" <xa...@xml.apache.org> on 2006/06/12 17:42:30 UTC

[jira] Commented: (XALANJ-2300) Bug with disable-output-escaping when using XSLTC and 2 TransformerHandler

    [ http://issues.apache.org/jira/browse/XALANJ-2300?page=comments#action_12415871 ] 

Andre Powroznik commented on XALANJ-2300:
-----------------------------------------

Setting the default value of org.apache.xml.serializer.ToXMLSAXHandler.m_escapeSetting to true instead of false solves the issue.

org.apache.xalan.xsltc.compiler.ValueOf.translate() "calls" this method twice only when _escaping is set to false (once to set it (to disable output escaping) and once to reset it). If the default value of org.apache.xml.serializer.ToXMLSAXHandler.m_escapeSetting is set to false, resetting it effectively disables output-escaping again.

Or : the default value of disable-output-escaping is false.

Andre Powroznik

> Bug with disable-output-escaping when using XSLTC and 2 TransformerHandler
> --------------------------------------------------------------------------
>
>          Key: XALANJ-2300
>          URL: http://issues.apache.org/jira/browse/XALANJ-2300
>      Project: XalanJ2
>         Type: Bug

>   Components: XSLTC
>     Versions: 2.7
>     Reporter: Andre Powroznik

>
> Disable-output-escaping does not work correctly in this case : it is always disabled, where it should be disabled the first time and enabled the second time.
> === 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>");
> 		System.setProperty("javax.xml.transform.TransformerFactory",
> 				"org.apache.xalan.xsltc.trax.TransformerFactoryImpl");
> 		SAXTransformerFactory factory = (SAXTransformerFactory) SAXTransformerFactory
> 				.newInstance();
> 		System.out.println("factory = " + factory);
> 		TransformerHandler handler1 = factory
> 				.newTransformerHandler(new StreamSource(new File("foo.xsl")));
> 		TransformerHandler handler2 = factory.newTransformerHandler();
> 		handler2.setResult(new StreamResult(System.out));
> 		handler1.setResult(new SAXResult(handler2));
> 		new SAXOutputter(handler1).output(something);
> 	}
> }
> === foo.xsl ===
> <?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" />
> 		No: <xsl:value-of select="/something" disable-output-escaping="no" />
> 	</xsl:template>
> </xsl:stylesheet>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org