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 11:58:30 UTC

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

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


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

Posted by "Andre Powroznik (JIRA)" <xa...@xml.apache.org>.
    [ 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


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

Posted by "Brian Minchau (JIRA)" <xa...@xml.apache.org>.
     [ http://issues.apache.org/jira/browse/XALANJ-2300?page=all ]
     
Brian Minchau resolved XALANJ-2300:
-----------------------------------

    Fix Version: Latest Development Code
     Resolution: Duplicate

Resolving as a duplicate of xalanj-2210

> 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
>      Fix For: Latest Development Code
>  Attachments: StringValueHandler.patch.txt
>
> 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


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

Posted by "Andre Powroznik (JIRA)" <xa...@xml.apache.org>.
    [ http://issues.apache.org/jira/browse/XALANJ-2300?page=comments#action_12416467 ] 

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

Moreover, I'm wondering if:
- shouldnt' the default value of the "m_escapeSetting" variable in "org.apache.xalan.serializer.ToHTMLSAXHandler" set to "true" instead of "false"? (case of output-method=html) ;
- shouldn't the "setEscaping" method in "org.apache.xalan.xsltc.runtime.StringValueHandler" return "oldEscaping" instead of "bool"? (the "setEscaping" method is supposed to return the previous escaping value).

> 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


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

Posted by "Brian Minchau (JIRA)" <xa...@xml.apache.org>.
    [ http://issues.apache.org/jira/browse/XALANJ-2300?page=comments#action_12418313 ] 

Brian Minchau commented on XALANJ-2300:
---------------------------------------

Andre,
issue XALANJ-2218 already fixes part of your problem, the field ToXMLSAXHandler.m_escapeSetting has an initial value of true (as you suggest).
The patch in XALANJ-2218 was already applied to the latest code. It isn't in the published 2.7 release but would make the next release or point release. The patch for 2218 also catches a few other spots where the serializer gets re-set, but essentially you are correct on this field's initial value.

As for your suggestion on org.apache.xalan.xsltc.runtime.StringValueHandler, I suspect that you might be right, but haven't looked into that part.
- Brian Minchau

> 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


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

Posted by "Andre Powroznik (JIRA)" <xa...@xml.apache.org>.
    [ http://issues.apache.org/jira/browse/XALANJ-2300?page=comments#action_12418589 ] 

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

Brian,

I think you are right, this is the same issue as XALANJ-2218. I had done a quick search in JIRA prior to submitting my bug, but I did not notice XALANJ-2218.

Kind regards,

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
>  Attachments: StringValueHandler.patch.txt
>
> 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