У меня та же проблема, что и Удалите ошибки проверки правописания слов из WordML и объедините узлы - для которых @Rupesh_Kr предоставил предложенный шаблон xsl.Как мне его использовать (недостаточно репутации, чтобы спросить там)?Я надеюсь, что он удаляет теги XML Microsoft Word proofErr w: type = "spellStart" и w: type = "spellEnd", которые разбивают строки в моем документе.В настоящее время я использую XSL для получения более различимых результатов, добавляя возврат каретки, поэтому я попытался заменить его на его и использовать команду "msxsl.exe -xeystem.xml xml.xsl", где xml.xsl содержит его предложение, но получаетследующая ошибка:
Code: 0xc00ce01d
URL: file:///xml.xsl
Line: 17
Column: 12
Reference to undeclared namespace prefix: 'w'.
xml.xsl содержит его предложение, как показано ниже:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!--
! This is an XML to XML transformation intended to be imported into a host
! XSLT. The source .xml file is copied verbatim by default.
! The importing XSL Transform should specify xsl:output as xml, and should
! contain templates to override the node and attribute match made here so
! that it can transform specific portions of the original XML file.
-->
<xsl:output method="xml" encoding="utf-8" indent="yes" />
<!-- ========================================================================
-->
<xsl:template match="w:p[w:proofErr]/w:r[1]">
<w:r>
<w:t>
<xsl:value-of select=".."/>
</w:t>
</w:r>
</xsl:template>
<xsl:template match="w:p[w:proofErr]/w:r[position() > 1]"/>
</xsl:stylesheet>
Ниже приведен пример входного файла, упрощенный удалением многих определений MS Word:
<?xml version="1.0" encoding="utf-8"?>
<?mso-application progid="Word.Document"?>
<w:wordDocument w:macrosPresent="no" w:embeddedObjPresent="no" w:ocxPresent="no" xml:space="preserve" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:cx="http://schemas.microsoft.com/office/drawing/2014/chartex" xmlns:cx1="http://schemas.microsoft.com/office/drawing/2015/9/8/chartex" xmlns:cx2="http://schemas.microsoft.com/office/drawing/2015/10/21/chartex" xmlns:cx3="http://schemas.microsoft.com/office/drawing/2016/5/9/chartex" xmlns:cx4="http://schemas.microsoft.com/office/drawing/2016/5/10/chartex" xmlns:cx5="http://schemas.microsoft.com/office/drawing/2016/5/11/chartex" xmlns:cx6="http://schemas.microsoft.com/office/drawing/2016/5/12/chartex" xmlns:cx7="http://schemas.microsoft.com/office/drawing/2016/5/13/chartex" xmlns:cx8="http://schemas.microsoft.com/office/drawing/2016/5/14/chartex" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:aink="http://schemas.microsoft.com/office/drawing/2016/ink" xmlns:am3d="http://schemas.microsoft.com/office/drawing/2017/model3d" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wsp="http://schemas.microsoft.com/office/word/2003/wordml/sp2" xmlns:sl="http://schemas.microsoft.com/schemaLibrary/2003/core">
<w:ignoreSubtree w:val="http://schemas.microsoft.com/office/word/2003/wordml/sp2"></w:ignoreSubtree>
<o:DocumentProperties>
<o:Lines>1</o:Lines>
</o:DocumentProperties>
<w:fonts>
</w:fonts>
<w:body>
<wx:sect>
<w:p>
<w:pPr>
<w:pStyle w:val="BodyText"></w:pStyle>
</w:pPr>
<w:proofErr w:type="spellStart"></w:proofErr>
<w:r>
<w:t>Hellow</w:t>
</w:r>
<w:proofErr w:type="spellEnd"></w:proofErr>
<w:r>
<w:t> </w:t>
</w:r>
<w:proofErr w:type="spellStart"></w:proofErr>
<w:r>
<w:t>world!</w:t>
</w:r>
<w:proofErr w:type="spellEnd"></w:proofErr>
</w:p>
<w:sectPr>
<w:ftr w:type="odd">
</w:ftr>
</w:sectPr>
</wx:sect>
</w:body>
</w:wordDocument>
Желаемый результат будет:
<?xml version="1.0" encoding="utf-8"?>
<?mso-application progid="Word.Document"?>
<w:wordDocument w:macrosPresent="no" w:embeddedObjPresent="no" w:ocxPresent="no" xml:space="preserve" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:cx="http://schemas.microsoft.com/office/drawing/2014/chartex" xmlns:cx1="http://schemas.microsoft.com/office/drawing/2015/9/8/chartex" xmlns:cx2="http://schemas.microsoft.com/office/drawing/2015/10/21/chartex" xmlns:cx3="http://schemas.microsoft.com/office/drawing/2016/5/9/chartex" xmlns:cx4="http://schemas.microsoft.com/office/drawing/2016/5/10/chartex" xmlns:cx5="http://schemas.microsoft.com/office/drawing/2016/5/11/chartex" xmlns:cx6="http://schemas.microsoft.com/office/drawing/2016/5/12/chartex" xmlns:cx7="http://schemas.microsoft.com/office/drawing/2016/5/13/chartex" xmlns:cx8="http://schemas.microsoft.com/office/drawing/2016/5/14/chartex" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:aink="http://schemas.microsoft.com/office/drawing/2016/ink" xmlns:am3d="http://schemas.microsoft.com/office/drawing/2017/model3d" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wsp="http://schemas.microsoft.com/office/word/2003/wordml/sp2" xmlns:sl="http://schemas.microsoft.com/schemaLibrary/2003/core">
<w:ignoreSubtree w:val="http://schemas.microsoft.com/office/word/2003/wordml/sp2"></w:ignoreSubtree>
<o:DocumentProperties>
<o:Lines>1</o:Lines>
</o:DocumentProperties>
<w:fonts>
</w:fonts>
<w:body>
<wx:sect>
<w:p>
<w:pPr>
<w:pStyle w:val="BodyText"></w:pStyle>
</w:pPr>
<w:r>
<w:t>Hellow world!</w:t>
</w:r>
</w:p>
<w:sectPr>
<w:ftr w:type="odd">
</w:ftr>
</w:sectPr>
</wx:sect>
</w:body>
</w:wordDocument>