This is an automated email from the ASF dual-hosted git repository.

jimjag pushed a commit to branch odf-devel
in repository https://gitbox.apache.org/repos/asf/openoffice.git

commit c823588863f1598b7dcefcfc531496cba1ffb82e
Author: Jim Jagielski <[email protected]>
AuthorDate: Tue Oct 27 10:49:25 2026 -0400

    xmloff: don't write preserved foreign attributes in ODF 1.2 strict mode
---
 main/sw/source/filter/xml/xmlexpit.cxx | 6 ++++--
 main/xmloff/source/style/xmlexppr.cxx  | 4 +++-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/main/sw/source/filter/xml/xmlexpit.cxx 
b/main/sw/source/filter/xml/xmlexpit.cxx
index e954214140..a135aec410 100644
--- a/main/sw/source/filter/xml/xmlexpit.cxx
+++ b/main/sw/source/filter/xml/xmlexpit.cxx
@@ -174,8 +174,10 @@ void SvXMLExportItemMapper::exportXML( const SvXMLExport& 
rExport,
                        OUStringBuffer sName;
                        for( sal_uInt16 i=0; i < nCount; i++ )
                        {
-                               if( rExport.getDefaultVersion() >= 
SvtSaveOptions::ODFVER_012 &&
-                                       SvXMLIsODFNamespace( 
pUnknown->GetAttrNamespace( i ) ) )
+                               // strict ODF 1.2: foreign attributes are 
invalid too
+                               if( rExport.getDefaultVersion() == 
SvtSaveOptions::ODFVER_012 ||
+                                       ( rExport.getDefaultVersion() >= 
SvtSaveOptions::ODFVER_012 &&
+                                         SvXMLIsODFNamespace( 
pUnknown->GetAttrNamespace( i ) ) ) )
                                        continue;
                                OUString sPrefix( pUnknown->GetAttrPrefix( i ) 
);
                                if( sPrefix.getLength() )
diff --git a/main/xmloff/source/style/xmlexppr.cxx 
b/main/xmloff/source/style/xmlexppr.cxx
index 44ada8d8ed..1483f85189 100644
--- a/main/xmloff/source/style/xmlexppr.cxx
+++ b/main/xmloff/source/style/xmlexppr.cxx
@@ -996,10 +996,12 @@ void SvXMLExportPropertyMapper::_exportXML(
                        OUStringBuffer sNameBuffer;
                        xml::AttributeData aData;
                        const sal_Bool bSkipODFNamespaces( 
SvtSaveOptions().GetODFDefaultVersion() >= SvtSaveOptions::ODFVER_012 );
+                       // strict ODF 1.2: foreign attributes are invalid too
+                       const sal_Bool bSkipForeign( 
SvtSaveOptions().GetODFDefaultVersion() == SvtSaveOptions::ODFVER_012 );
                        for( sal_Int32 i=0; i < nCount; i++, pAttribName++ )
                        {
                                xAttrContainer->getByName( *pAttribName ) >>= 
aData;
-                               if( bSkipODFNamespaces && SvXMLIsODFNamespace( 
aData.Namespace ) )
+                               if( bSkipForeign || ( bSkipODFNamespaces && 
SvXMLIsODFNamespace( aData.Namespace ) ) )
                                        continue;
                                OUString sAttribName( *pAttribName );
 

Reply via email to