Issue Details (XML | Word | Printable)

Key: XALANJ-2218
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Brian Minchau
Reporter: Libor Valenta
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
XalanJ2

XML/HTML serializers should have default m_escapeSetting = true

Created: 23/Oct/05 09:39 AM   Updated: 11/Dec/07 04:57 PM
Return to search
Component/s: Serialization
Affects Version/s: 2.7
Fix Version/s: 2.7.1

Time Tracking:
Not Specified

File Attachments:
  Size
File Licensed for inclusion in ASF works patch.diff 2005-10-23 09:43 AM Libor Valenta 1 kB
Text File Licensed for inclusion in ASF works patch2.txt 2006-03-11 07:45 AM Brian Minchau 1 kB
Java Source File Licensed for inclusion in ASF works TestEscaping.java 2005-10-23 09:43 AM Libor Valenta 4 kB
Environment: I have problem with code bundled in Java 5 as well as the latest development version

Xalan info: PatchAvailable
Reviewer: Brian Minchau
Resolution Date: 11/Mar/06 07:50 AM


 Description  « Hide
I started using XSLTC but I have problem with results it produces.

I have
XML:
<a>&amp;<b/>&amp;</a>

XSL:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output indent="no" omit-xml-declaration="yes" />
    <xsl:template match="/">
        <result>
            <xsl:apply-templates />
        </result>
    </xsl:template>
    <xsl:template match="b">
        <xsl:text disable-output-escaping="yes">&amp;</xsl:text>
    </xsl:template>
</xsl:stylesheet>

I would expect to have in result (see processing instructions)
[[Text: &], [ProcessingInstruction: <?javax.xml.transform.disable-output-escaping?>], [Text: &], [ProcessingInstruction: <?javax.xml.transform.enable-output-escaping?>], [Text: &]]

not

[[Text: &], [ProcessingInstruction: <?javax.xml.transform.disable-output-escaping?>], [Text: &], [ProcessingInstruction: <?javax.xml.transform.disable-output-escaping?>], [Text: &]]

For example in org.apache.xml.serializer.ToXMLSAXHandler m_escapeSetting is by default false
The start of <xsl:text disable-output-escaping="yes"> will call setEscaping(false) which return false - the old value
At the end of </xsl:text> will be called setEscaping(false) - where false is the original value returned by previous call.
m_escapeSetting will never be true, but most importantly the resulting DOM makes no sense.

also org.apache.xalan.xsltc.runtime.StringValueHandler.setEscaping(boolean bool) looks fishy, I tnink it should retrurn the old value.


 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Repository Revision Date User Message
ASF #384956 Fri Mar 10 23:47:30 UTC 2006 minchau Committing patch for XALANJ-2218 which changes the initial value for
escaping of ToHTMLSAXHandler and ToXMLSAXHandler.
Files Changed
MODIFY /xalan/java/trunk/src/org/apache/xml/serializer/ToHTMLSAXHandler.java
MODIFY /xalan/java/trunk/src/org/apache/xml/serializer/ToXMLSAXHandler.java