Excel XSLT超出表达式结尾的意外标记

Excel XSLT超出表达式结尾的意外标记,excel,xml,xslt,ms-word,Excel,Xml,Xslt,Ms Word,这是从Excel文档转换而来的源XML文件: <?xml version="1.0"?> <?mso-application progid="Excel.Sheet"?> <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com

这是从Excel文档转换而来的源XML文件:

<?xml version="1.0"?>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
 xmlns:o="urn:schemas-microsoft-com:office:office"
 xmlns:x="urn:schemas-microsoft-com:office:excel"
 xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
 xmlns:html="http://www.w3.org/TR/REC-html40">
 <DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
  <Author>Passiflora Cui</Author>
  <LastAuthor>Passiflora Cui</LastAuthor>
  <Created>2019-06-30T21:49:41Z</Created>
  <LastSaved>2019-06-30T21:50:54Z</LastSaved>
  <Version>16.00</Version>
 </DocumentProperties>
 <OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">
  <AllowPNG/>
 </OfficeDocumentSettings>
 <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
  <WindowHeight>16940</WindowHeight>
  <WindowWidth>27640</WindowWidth>
  <WindowTopX>5580</WindowTopX>
  <WindowTopY>3560</WindowTopY>
  <ProtectStructure>False</ProtectStructure>
  <ProtectWindows>False</ProtectWindows>
 </ExcelWorkbook>
 <Styles>
  <Style ss:ID="Default" ss:Name="Normal">
   <Alignment ss:Vertical="Bottom"/>
   <Borders/>
   <Font ss:FontName="Calibri" x:Family="Swiss" ss:Size="12" ss:Color="#000000"/>
   <Interior/>
   <NumberFormat/>
   <Protection/>
  </Style>
  <Style ss:ID="s62">
   <Alignment ss:Horizontal="Center" ss:Vertical="Bottom"/>
  </Style>
 </Styles>
 <Worksheet ss:Name="Sheet1">
  <Table ss:ExpandedColumnCount="4" ss:ExpandedRowCount="5" x:FullColumns="1"
   x:FullRows="1" ss:DefaultColumnWidth="65" ss:DefaultRowHeight="16">
   <Column ss:AutoFitWidth="0" ss:Width="74"/>
   <Row>
    <Cell><Data ss:Type="String">Field1</Data></Cell>
    <Cell><Data ss:Type="String">Field2</Data></Cell>
    <Cell><Data ss:Type="String">Field3</Data></Cell>
    <Cell><Data ss:Type="String">Field4</Data></Cell>
   </Row>
   <Row>
    <Cell><Data ss:Type="String">Field1_Data1</Data></Cell>
    <Cell ss:StyleID="s62"><Data ss:Type="String">Field2_Data1</Data></Cell>
    <Cell><Data ss:Type="String">Field3_Data1</Data></Cell>
    <Cell><Data ss:Type="String">Field4_Data1</Data></Cell>
   </Row>
   <Row>
    <Cell><Data ss:Type="String">Field1_Data2</Data></Cell>
    <Cell ss:StyleID="s62"><Data ss:Type="String">Field2_Data2</Data></Cell>
    <Cell><Data ss:Type="String">Field3_Data2</Data></Cell>
    <Cell><Data ss:Type="String">Field4_Data2</Data></Cell>
   </Row>
   <Row>
    <Cell><Data ss:Type="String">Field1_Data3</Data></Cell>
    <Cell ss:StyleID="s62"><Data ss:Type="String">Field2_Data3</Data></Cell>
    <Cell><Data ss:Type="String">Field3_Data3</Data></Cell>
    <Cell><Data ss:Type="String">Field4_Data3</Data></Cell>
   </Row>
   <Row>
    <Cell><Data ss:Type="String">Field1_Data4</Data></Cell>
    <Cell ss:StyleID="s62"><Data ss:Type="String">Field2_Data4</Data></Cell>
    <Cell><Data ss:Type="String">Field3_Data4</Data></Cell>
    <Cell><Data ss:Type="String">Field4_Data4</Data></Cell>
   </Row>
  </Table>
  <WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
   <PageSetup>
    <Header x:Margin="0.3"/>
    <Footer x:Margin="0.3"/>
    <PageMargins x:Bottom="0.75" x:Left="0.7" x:Right="0.7" x:Top="0.75"/>
   </PageSetup>
   <Selected/>
   <Panes>
    <Pane>
     <Number>3</Number>
     <ActiveRow>5</ActiveRow>
     <ActiveCol>5</ActiveCol>
    </Pane>
   </Panes>
   <ProtectObjects>False</ProtectObjects>
   <ProtectScenarios>False</ProtectScenarios>
  </WorksheetOptions>
 </Worksheet>
</Workbook>

崔西番莲
崔西番莲
2019-06-30T21:49:41Z
2019-06-30T21:50:54Z
16
16940
27640
5580
3560
假的
假的
字段1
字段2
字段3
字段4
字段1_数据1
字段2_数据1
字段3_数据1
字段4_数据1
字段1_数据2
字段2_数据2
字段3_数据2
字段4_数据2
字段1_数据3
字段2_数据3
字段3_数据3
字段4_数据3
字段1_数据4
字段2_数据4
字段3_数据4
字段4_数据4
3.
5.
5.
假的
假的
这是我的XSLT,从将Excel XML文件转换为Word XML文件的较大XSLT中提取了问题部分,其中
元素导致错误:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version = "1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
    xmlns:wb="urn:schemas-microsoft-com:office:spreadsheet"
    xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">
    <xsl:output method = "xml" indent = "yes"/>

    <!-- Ignore all free text() nodes -->
    <xsl:template match="text()" />

    <xsl:template match = "/wb:Workbook/wb:Worksheet/wb:Table">
        <pkg:package xmlns:pkg="http://schemas.microsoft.com/office/2006/xmlPackage">
            <Result>
                <xsl:for-each select="wb:Row[position() > 1]">
                    <Test>
                        <Field1><xsl:value-of select = "wb:Cell[1]/wb:Data"/></Field1>
                        <Field2><xsl:value-of select = "wb:Cell[2]/wb:Data"/></Field2>
                        <Field3><xsl:value-of select = "wb:Cell[3]/wb:Data"/></Field3>
                        <Field4><xsl:value-of select = "wb:Cell[4]/wb:Data"/></Field4>
                    </Test>
                </xsl:for-each>
            </Result>
            <!--The following a:ext element is just directly copied to the result, which causes the errors-->
            <a:ext uri="{05A4C25C-085E-4340-85A3-A5531E510DB2}">
                <thm15:themeFamily xmlns:thm15="http://schemas.microsoft.com/office/thememl/2012/main" name="Office Theme" id="{62F939B6-93AF-4DB8-9C6B-D6C7DFDC589F}" vid="{4A3C46E8-61CC-4603-A589-7422A47A8E4A}"/>
            </a:ext>
        </pkg:package>
    </xsl:template>
</xsl:stylesheet>

元素是从Word XML复制的,只想直接复制到结果中。但是它报告了错误“超出表达式末尾的意外标记
”,完整的错误消息如下:

Severity: warning
Description: Error in expression 05A4C25C-085E-4340-85A3-A5531E510DB2: Unexpected token <name> beyond end of expression
Start location: 22:0

Severity: warning
Description: Error in expression 62F939B6-93AF-4DB8-9C6B-D6C7DFDC589F: Unexpected token <name> beyond end of expression
Start location: 23:0

Severity: warning
Description: Error in expression 4A3C46E8-61CC-4603-A589-7422A47A8E4A: Unexpected token <name> beyond end of expression
Start location: 23:0
严重性:警告
描述:表达式05A4C25C-085E-4340-85A3-A5531E510DB2中出错:超出表达式结尾的意外标记
出发地点:22:0
严重性:警告
描述:表达式62F939B6-93AF-4DB8-9C6B-D6C7DFDC589F中出错:超出表达式结尾的意外标记
出发地点:23:0
严重性:警告
描述:表达式4A3C46E8-61CC-4603-A589-7422A47A8E4A中出错:超出表达式结尾的意外标记
出发地点:23:0

如何解决这个问题?提前感谢您的帮助

属性中的大括号表示内容将被视为要计算的XPATH表达式。要获得您想要的,您需要将大括号加倍以避开它们:

        <a:ext uri="{{05A4C25C-085E-4340-85A3-A5531E510DB2}}">
            <thm15:themeFamily 
                xmlns:thm15="http://schemas.microsoft.com/office/thememl/2012/main" 
                name="Office Theme" 
                id="{{62F939B6-93AF-4DB8-9C6B-D6C7DFDC589F}}" 
                vid="{{4A3C46E8-61CC-4603-A589-7422A47A8E4A}}"/>
        </a:ext>