You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Mark Hewitt (JIRA)" <xa...@xml.apache.org> on 2004/12/08 09:46:11 UTC

[jira] Created: (XALANC-442) Turning indent off affects processing of omit-xml-declaration

Turning indent off affects processing of omit-xml-declaration
-------------------------------------------------------------

         Key: XALANC-442
         URL: http://nagoya.apache.org/jira/browse/XALANC-442
     Project: XalanC
        Type: Bug
  Components: XalanC  
    Versions: 1.8    
 Environment: AIX 5.2
    Reporter: Mark Hewitt
    Priority: Minor


The following transform

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="no" omit-xml-declaration="yes"/>
<xsl:template match="message">
	<xsl:element name="hello"><xsl:apply-templates/></xsl:element>
</xsl:template>
</xsl:stylesheet>

when applied to the following xml

<?xml version="1.0"?>
<message>hello world</message>

transforms to

<?xml version="1.0" encoding="UTF-8"?><hello>hello world</hello>

So the omit-xml-declaration is ignored.  If you use indent="yes" then the omit-xml-declaration is obeyed.


The problem seems to be that if doIndent == false then 
StylesheetExecutionContextDefault.cpp chooses FormatterToXML_UTF8
otherwise it chooses FormatterToXML.

These two classes differ in that FormatterToXMLBase which is used by 
FormatterToXML_UTF8 has the code

    // We must write the XML declaration if standalone is specified
    m_shouldWriteXMLHeader(xmlDecl == true ? true : standalone.length() == 0),

in its constructor initialization list.

While FormatterToXML just simply has

	m_shouldWriteXMLHeader(xmlDecl),

So the two behave differently and hence turning indent off or on affects the
behaviour of the transformer.

The two should be made to work consistently.  Also i'm not sure if
standalone.length() == 0 is really what is needed.  Shouldnt we test
to see if it is "yes" or "no" or empty?







-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://nagoya.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report 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: (XALANC-442) Turning indent off affects processing of omit-xml-declaration

Posted by "David Bertoni (JIRA)" <xa...@xml.apache.org>.
     [ http://nagoya.apache.org/jira/browse/XALANC-442?page=comments#action_56395 ]
     
David Bertoni commented on XALANC-442:
--------------------------------------

Duplicate of XALANC-421.

> Turning indent off affects processing of omit-xml-declaration
> -------------------------------------------------------------
>
>          Key: XALANC-442
>          URL: http://nagoya.apache.org/jira/browse/XALANC-442
>      Project: XalanC
>         Type: Bug
>   Components: XalanC
>     Versions: 1.8
>  Environment: AIX 5.2
>     Reporter: Mark Hewitt
>     Priority: Minor
>      Fix For: CurrentCVS

>
> The following transform
> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <xsl:output method="xml" indent="no" omit-xml-declaration="yes"/>
> <xsl:template match="message">
> 	<xsl:element name="hello"><xsl:apply-templates/></xsl:element>
> </xsl:template>
> </xsl:stylesheet>
> when applied to the following xml
> <?xml version="1.0"?>
> <message>hello world</message>
> transforms to
> <?xml version="1.0" encoding="UTF-8"?><hello>hello world</hello>
> So the omit-xml-declaration is ignored.  If you use indent="yes" then the omit-xml-declaration is obeyed.
> The problem seems to be that if doIndent == false then 
> StylesheetExecutionContextDefault.cpp chooses FormatterToXML_UTF8
> otherwise it chooses FormatterToXML.
> These two classes differ in that FormatterToXMLBase which is used by 
> FormatterToXML_UTF8 has the code
>     // We must write the XML declaration if standalone is specified
>     m_shouldWriteXMLHeader(xmlDecl == true ? true : standalone.length() == 0),
> in its constructor initialization list.
> While FormatterToXML just simply has
> 	m_shouldWriteXMLHeader(xmlDecl),
> So the two behave differently and hence turning indent off or on affects the
> behaviour of the transformer.
> The two should be made to work consistently.  Also i'm not sure if
> standalone.length() == 0 is really what is needed.  Shouldnt we test
> to see if it is "yes" or "no" or empty?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://nagoya.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report 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: (XALANC-442) Turning indent off affects processing of omit-xml-declaration

Posted by "David Bertoni (JIRA)" <xa...@xml.apache.org>.
     [ http://nagoya.apache.org/jira/browse/XALANC-442?page=history ]
     
David Bertoni resolved XALANC-442:
----------------------------------

     Resolution: Duplicate
    Fix Version: CurrentCVS

> Turning indent off affects processing of omit-xml-declaration
> -------------------------------------------------------------
>
>          Key: XALANC-442
>          URL: http://nagoya.apache.org/jira/browse/XALANC-442
>      Project: XalanC
>         Type: Bug
>   Components: XalanC
>     Versions: 1.8
>  Environment: AIX 5.2
>     Reporter: Mark Hewitt
>     Priority: Minor
>      Fix For: CurrentCVS

>
> The following transform
> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <xsl:output method="xml" indent="no" omit-xml-declaration="yes"/>
> <xsl:template match="message">
> 	<xsl:element name="hello"><xsl:apply-templates/></xsl:element>
> </xsl:template>
> </xsl:stylesheet>
> when applied to the following xml
> <?xml version="1.0"?>
> <message>hello world</message>
> transforms to
> <?xml version="1.0" encoding="UTF-8"?><hello>hello world</hello>
> So the omit-xml-declaration is ignored.  If you use indent="yes" then the omit-xml-declaration is obeyed.
> The problem seems to be that if doIndent == false then 
> StylesheetExecutionContextDefault.cpp chooses FormatterToXML_UTF8
> otherwise it chooses FormatterToXML.
> These two classes differ in that FormatterToXMLBase which is used by 
> FormatterToXML_UTF8 has the code
>     // We must write the XML declaration if standalone is specified
>     m_shouldWriteXMLHeader(xmlDecl == true ? true : standalone.length() == 0),
> in its constructor initialization list.
> While FormatterToXML just simply has
> 	m_shouldWriteXMLHeader(xmlDecl),
> So the two behave differently and hence turning indent off or on affects the
> behaviour of the transformer.
> The two should be made to work consistently.  Also i'm not sure if
> standalone.length() == 0 is really what is needed.  Shouldnt we test
> to see if it is "yes" or "no" or empty?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://nagoya.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report 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