<?xml version='1.0' encoding='UTF-8'?>
<wd:Report_Data
xmlns:wd="urn:com.workday.report/CIS_CR_INT122_HMS_Dependent_Report">
<wd:Report_Entry>
<wd:Dependents>
<wd:project_id>2269</wd:project_id>
<wd:plan_id>5909</wd:plan_id>
<wd:employee_client_id>JA5637</wd:employee_client_id>
</wd:Dependents>
</wd:Report_Entry>
<wd:Report_Entry>
<wd:Dependents>
<wd:project_id>2269</wd:project_id>
<wd:plan_id>5909</wd:plan_id>
<wd:employee_client_id>JA4345</wd:employee_client_id>
</wd:Dependents>
</wd:Report_Entry>
<wd:Report_Entry>
<wd:Dependents>
<wd:project_id>2269</wd:project_id>
<wd:plan_id>5909</wd:plan_id>
<wd:employee_client_id>JA5637</wd:employee_client_id>
</wd:Dependents>
</wd:Report_Entry>
</wd:Report_Data>
XLST不工作。它不顯示,分隔符或換行。我還需要刪除重複的employee_client_id。前JA5637來了兩次,我需要刪除使用XSLT。每個依賴關係都應該放在一個帶有逗號分隔符的新行中。見下文XSLT 2.0轉換
樣品XSLT我建
輸出 <?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs"
version="2.0">
<xsl:strip-space elements="*"/>
<xsl:variable name="NEWLINE">
<xsl:text> </xsl:text>
</xsl:variable>
<xsl:variable name="DELIMITER">,</xsl:variable>
<xsl:output method="text"/>
<xsl:template match="wd:Report_Data"
xmlns:wd="urn:com.comday.report/INT007BOutbound">
<!--These are just text column headers for output-->
<xsl:text>project_id,plan_id,employee_client_id</xsl:text>
<xsl:value-of select="$NEWLINE"/>
<xsl:for-each select="wd:Report_Entry">
<xsl:for-each select="wd:Dependents">
<xsl:value-of select="wd:project_id"/>
<xsl:value-of select="$DELIMITER"/>
<xsl:text>
</xsl:text>
<xsl:value-of select="wd:plan_id"/>
<xsl:value-of select="$DELIMITER"/>
<xsl:text>,</xsl:text>
<xsl:value-of select="wd:employee_client_id"/>
</xsl:for-each>
<xsl:value-of select="$NEWLINE"/>
<xsl:text>
</xsl:text>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
輸出
項目-ID,plan_id的數據類型,employee_client_id
2269,5909,JA5637
2269,5909,JA4345
非常感謝邁克爾,我想通了這一點,但沒有張貼和回答。我真的很感謝你的幫助。 –