使用XSLT在一个工作表中创建多个表

时间:2018-06-13 21:53:48

标签: xml xslt xslt-1.0

我正在使用xslt 1.0将XML转换为Excel。我试图在同一个工作表上添加多个表,但是xslt转换器没有在同一工作表上呈现第二个表。我尝试通过向此XSLT添加另一个标记,但只有1个表被转换。 真诚地感谢这里的任何专家可以帮助和指导我....如果XSLT允许将多个表添加到同一工作表中?如果是,请告知如何?

    <xsl:stylesheet version="1.0"
    xmlns="urn:schemas-microsoft-com:office:spreadsheet"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt"
    xmlns:user="urn:my-scripts"
    xmlns:o="urn:schemas-microsoft-com:office:office"
    xmlns:x="urn:schemas-microsoft-com:office:excel"
    xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" >
    <xsl:template match="KMCRPAData">
    <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">
    <Styles>
      <Style ss:ID="header">
      <Font ss:FontName="Calibri" ss:Size="14" ss:Bold="1" 
    x:Family="Swiss" ss:Color="white"/>
    <Borders>
    <Border ss:LineStyle="Continuous" ss:Position="Left" ss:Weight="1"/>
    <Border ss:LineStyle="Continuous" ss:Position="Top" ss:Weight="1"/>
    </Borders>
    <Interior ss:Color="#014a8e" ss:Pattern="Solid"/>
    <Alignment ss:Vertical="Bottom" ss:WrapText="1"/>
    </Style>
    <Style ss:ID="subHeader">
    <Font ss:FontName="Calibri" ss:Size="10" x:Family="Swiss" 
    ss:Color="black"/>
    <Borders>
    <Border ss:LineStyle="Continuous" ss:Position="Left" ss:Weight="1"/>
    <Border ss:LineStyle="Continuous" ss:Position="Top" ss:Weight="1"/>
    </Borders>
    <Interior ss:Color="#E0EBF8" ss:Pattern="Solid"/>
    <Alignment ss:Vertical="Bottom"/>
    </Style>
    <Style ss:ID="rows">
<Font ss:FontName="Calibri" ss:Size="10" x:Family="Swiss" ss:Color="black"/>
    <Borders>
        <Border ss:LineStyle="Continuous" ss:Position="Left" ss:Weight="1"/>
        <Border ss:LineStyle="Continuous" ss:Position="Right" ss:Weight="1"/>
        <Border ss:LineStyle="Continuous" ss:Position="Top" ss:Weight="1"/>
        <Border ss:LineStyle="Continuous" ss:Position="Bottom"ss:Weight="1"/>
    </Borders>
        </Style>
    </Styles>   
      <Worksheet ss:Name="KMCRPAData">
        <Table ss:DefaultRowHeight="16" x:FullColumns="1" x:FullRows="1">
            <Column ss:Index="1" ss:Width="200"/>
            <Column ss:Index="2" ss:Width="200"/>
            <Column ss:Index="3" ss:Width="200"/>
            <xsl:apply-templates select="KMCRPAData"/>
            <Row>
                <Cell ss:Index="1" ss:StyleID="header">
                    <Data ss:Type="String">Summary</Data>
                </Cell>
                <Cell ss:Index="2" ss:StyleID="header">
                    <Data ss:Type="String"></Data>
                </Cell>
                <Cell ss:Index="3" ss:StyleID="header">
                    <Data ss:Type="String">KYC Owner Approval</Data>
                </Cell>
            </Row>
            <Row>
                <!-- Header Row -->
                <Cell ss:Index="1"  ss:StyleID="subHeader">
                    <Data ss:Type="String">GFCID</Data>
                </Cell>
                <Cell ss:Index="2"  ss:StyleID="rows">
                    <Data ss:Type="String">
                        <xsl:value-of select="//clientMain/GFCID"/>
                    </Data>
                </Cell>
                <Cell ss:Index="3" ss:StyleID="rows">
                    <Data ss:Type="String"></Data>
                </Cell>
            </Row>
            <Row>
                <Cell ss:Index="1"  ss:StyleID="subHeader">
                    <Data ss:Type="String">KYCID</Data>
                </Cell>
                <Cell ss:Index="2"  ss:StyleID="rows">
                    <Data ss:Type="String">
                        <xsl:value-of select="//clientMain/KYCID"/>
                    </Data>
                </Cell>
                <Cell ss:Index="3" ss:StyleID="rows">
                    <Data ss:Type="String"></Data>
                </Cell>
            </Row>
            <Row>
                <Cell ss:Index="1"  ss:StyleID="subHeader">
                    <Data ss:Type="String">KYC Record Date</Data>
                </Cell>
                <Cell ss:Index="2"  ss:StyleID="rows">
                    <Data ss:Type="String">
                        <xsl:value-of select="//clientMain/KYCRecordState"/>
                    </Data>
                </Cell>
                <Cell ss:Index="3" ss:StyleID="rows">
                    <Data ss:Type="String"></Data>
                </Cell>
            </Row>
            <Row>
                <Cell ss:Index="1"  ss:StyleID="subHeader">
                    <Data ss:Type="String">KYC Record Status</Data>
                </Cell>
                <Cell ss:Index="2"  ss:StyleID="rows">
                    <Data ss:Type="String">
                        <xsl:value-of select="//clientMain/KYCRecordStatus"/>
                    </Data>
                </Cell>
                <Cell ss:Index="3" ss:StyleID="rows">
                    <Data ss:Type="String"></Data>
                </Cell>
            </Row>
            <Row>
                <Cell ss:Index="1"  ss:StyleID="subHeader">
                    <Data ss:Type="String">KMC Creation Timestamp</Data>
                </Cell>
                <Cell ss:Index="2"  ss:StyleID="rows">
                    <Data ss:Type="String">
                <xsl:value-of select="//clientMain/KMCCreationTimestamp"/>
                    </Data>
                </Cell>
                <Cell ss:Index="3" ss:StyleID="rows">
                    <Data ss:Type="String"></Data>
                </Cell>
            </Row>
            <Row>
                <Cell ss:Index="1"  ss:StyleID="subHeader">
                    <Data ss:Type="String">KMC Last Refresh Timestamp</Data>
                </Cell>
                <Cell ss:Index="2"  ss:StyleID="rows">
                    <Data ss:Type="String">
                <xsl:value-of select="//clientMain/KMCLastRefreshTimestamp"/>
                    </Data>
                </Cell>
                <Cell ss:Index="3" ss:StyleID="rows">
                    <Data ss:Type="String"></Data>
                </Cell>
            </Row>              
        </Table>
        </Worksheet>
    </Workbook>
   </xsl:template>  
 </xsl:stylesheet>

0 个答案:

没有答案