从给定的xslt转换正确的xml时,数据未按行级别拆分,并且csv / text中的数据在单行中继续。
尝试换行和代码,但数据无法正确显示。
XML:
<?xml version='1.0' encoding='UTF-8'?>
<wd:Report_Data xmlns:wd="urn:com.workday.report/HFC">
<wd:Report_Entry>
<wd:Related_Calculated_Time_Blocks>
<wd:Workday_ID>26b15207b31981e8759</wd:Workday_ID>
<wd:Time_Block>8 HOURS ON 01/01/2019</wd:Time_Block>
<wd:Worker>ABC</wd:Worker>
<wd:Employee_ID>100</wd:Employee_ID>
<wd:Reported_Date>2019-01-01</wd:Reported_Date>
<wd:Time_Entry_Code>Adjust Holiday Hours</wd:Time_Entry_Code>
<wd:Unit>Hours</wd:Unit>
<wd:Calculated_Quantity>1.78923</wd:Calculated_Quantity>
<wd:EE_Calculation_Tag_is_Single_Instance>Holiday</wd:EE_Calculation_Tag_is_Single_Instance>
<wd:EE_Calculation_Tag_is_Single_Instance__Numeric_>111</wd:EE_Calculation_Tag_is_Single_Instance__Numeric_>
<wd:Source>User Entered</wd:Source>
</wd:Related_Calculated_Time_Blocks>
</wd:Report_Entry>
<wd:Report_Entry>
<wd:Related_Calculated_Time_Blocks>
<wd:Workday_ID>f3b6c47bca118110</wd:Workday_ID>
<wd:Time_Block>8 HOURS ON 01/01/2019</wd:Time_Block>
<wd:Worker>DEF</wd:Worker>
<wd:Employee_ID>101</wd:Employee_ID>
<wd:Reported_Date>2019-01-01</wd:Reported_Date>
<wd:Time_Entry_Code>Adjust Holiday Hours</wd:Time_Entry_Code>
<wd:Unit>Hours</wd:Unit>
<wd:Calculated_Quantity>8</wd:Calculated_Quantity>
<wd:EE_Calculation_Tag_is_Single_Instance>Holiday</wd:EE_Calculation_Tag_is_Single_Instance>
<wd:EE_Calculation_Tag_is_Single_Instance__Numeric_>111</wd:EE_Calculation_Tag_is_Single_Instance__Numeric_>
<wd:Source>User Entered</wd:Source>
</wd:Related_Calculated_Time_Blocks>
</wd:Report_Entry>
</wd:Report_Data>
******************* XSLT ************************** < / p>
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:wd="urn:com.workday.report/HFC">
<xsl:output method="text"></xsl:output>
<xsl:variable name="linefeed" select="'
'"/>
<xsl:template match="wd:Report_Entry">
<File xmlns:xtt="urn:com.workday.report/HFC" xtt:quotes="csv" xtt:separator="
">
<xsl:for-each select="wd:Related_Calculated_Time_Blocks">
<Record xtt:separator="	" xtt:quotes="csv">
<xsl:value-of select="wd:Workday_ID"/>
<xsl:text>	</xsl:text>
<xsl:value-of select="1"/>
<xsl:text>	</xsl:text>
<xsl:value-of select="wd:Reported_Date"/>
<xsl:text>	</xsl:text>
<xsl:value-of select="wd:EE_Calculation_Tag_is_Single_Instance"/>
<xsl:text>	</xsl:text>
<xsl:value-of select="''"/>
<xsl:text>	</xsl:text>
<xsl:value-of select="''"/>
<xsl:text>	</xsl:text>
<xsl:value-of select="''"/>
<xsl:text>	</xsl:text>
<xsl:value-of select="''"/>
<xsl:text>	</xsl:text>
<xsl:value-of select="wd:Calculated_Quantity"/>
<xsl:text>	</xsl:text>
<xsl:value-of select="'Quantity'"/>
<xsl:text>	</xsl:text>
<xsl:value-of select="wd:Reported_Date"/>
<xsl:text>	</xsl:text>
<xsl:value-of select="'DELLL'"/>
<xsl:value-of select="$linefeed"/>
</Record>
</xsl:for-each>
</File>
</xsl:template>
</xsl:stylesheet>
我期望数据在行级别,但在列级别继续: