prolog中不允许XML内容



我不知道我是否以正确的方式做。但我只是尝试在 xml 中使用命名空间.当我尝试将xml转换为xsl时,收到此错误XML Content is not allowed in prolog

这是我的xml.

<?xml version="1.0" encoding="UTF-8"?>
<pi:Payroll_Extract_Employees xmlns:pi="urn:com.sdsd/picof">
    <pi:PayGroup>
    <pi:Header>
        <pi:Version>19</pi:Version>
        <pi:Payroll_Company_ID>ADSDP</pi:Payroll_Company_ID>
        <pi:Payroll_Company_Name>ADSDP</pi:Payroll_Company_Name>
        <pi:Pay_Group_ID>US1</pi:Pay_Group_ID>
        <pi:Pay_Group_Name>US1 Salaried</pi:Pay_Group_Name>
        <pi:Pay_Period_Start>2015-02-01-07:00</pi:Pay_Period_Start>
        <pi:Pay_Period_End>2015-02-14-07:00</pi:Pay_Period_End>
        <pi:Updated_From>2015-02-05T06:03:48.000-07:00</pi:Updated_From>
        <pi:Updated_To>2015-02-06T19:47:39.457-07:00</pi:Updated_To>
        <pi:All_Effective>false</pi:All_Effective>
    </pi:Header>
    </pi:PayGroup>
 </pi:Payroll_Extract_Employees>

这是我的xsl

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="xd" xmlns:pi="urn:com.workday/picof">
<xsl:template match="/pi:Payroll_Extract_Employees/PayGroup/Header">
<folder>
    <file>
        <item><xsl:value-of select="Version"/></item>
        <item><xsl:value-of select="Payroll_Company_ID"/></item>
    </file>
    <file>
        <item><xsl:value-of select="Pay_Group_ID"/></item>
        <item><xsl:value-of select="Pay_Period_Start"/></item>
    </file>
</folder>
</xsl:template>

如果我以错误的方式做,有人可以指导我吗?

如果要应用模板,请确保在所有步骤中使用前缀:

<xsl:template match="/pi:Payroll_Extract_Employees/pi:PayGroup/pi:Header"> <folder> <file> <item><xsl:value-of select="pi:Version"/></item> <item><xsl:value-of select="pi:Payroll_Company_ID"/></item> </file> <file> <item><xsl:value-of select="pi:Pay_Group_ID"/></item> <item><xsl:value-of select="pi:Pay_Period_Start"/></item> </file> </folder> </xsl:template>

最新更新