我是 xslt 新手,我正在使用以下 XML
<?xml version='1.0' encoding='UTF-8'?>
<wd:Report_Data xmlns:wd="urn:com.workday.report/INT0194_Recruitics">
<wd:Report_Entry>
<wd:Job_Requisition_group>
<wd:Is_Evergreen>0</wd:Is_Evergreen>
</wd:Job_Requisition_group>
<wd:Job_Application_Process_Statuses_group>
<wd:Last_Functionally_Updated>2023-06-26T12:50:11.949-07:00</wd:Last_Functionally_Updated>
<wd:Stage wd:Descriptor="Review">
<wd:ID wd:type="WID">31350d72f899430fb446b410c1e368cd</wd:ID>
<wd:ID wd:type="Recruiting_Stage_ID">REVIEW</wd:ID>
</wd:Stage>
</wd:Job_Application_Process_Statuses_group>
<wd:Job_Application_Process_Statuses_group>
<wd:Last_Functionally_Updated>2023-06-26T12:50:11.949-07:00</wd:Last_Functionally_Updated>
<wd:Stage wd:Descriptor="Rejected">
<wd:ID wd:type="WID">9a35fa5882c24620a777de1dbcf34d3c</wd:ID>
<wd:ID wd:type="Recruiting_Stage_ID">REJECTED</wd:ID>
</wd:Stage>
</wd:Job_Application_Process_Statuses_group>
<wd:candidate>C-0000704156</wd:candidate>
<wd:Requisition_ID>R-0000051703</wd:Requisition_ID>
</wd:Report_Entry>
<wd:Report_Entry>
<wd:Job_Requisition_group>
<wd:Is_Evergreen>0</wd:Is_Evergreen>
</wd:Job_Requisition_group>
<wd:Job_Application_Process_Statuses_group>
<wd:Last_Functionally_Updated>2024-02-29T13:26:32.874-08:00</wd:Last_Functionally_Updated>
<wd:Stage wd:Descriptor="Review">
<wd:ID wd:type="WID">31350d72f899430fb446b410c1e368cd</wd:ID>
<wd:ID wd:type="Recruiting_Stage_ID">REVIEW</wd:ID>
</wd:Stage>
</wd:Job_Application_Process_Statuses_group>
<wd:Job_Application_Process_Statuses_group>
<wd:Last_Functionally_Updated>2024-02-29T13:26:32.874-08:00</wd:Last_Functionally_Updated>
<wd:Stage wd:Descriptor="Rejected">
<wd:ID wd:type="WID">9a35fa5882c24620a777de1dbcf34d3c</wd:ID>
<wd:ID wd:type="Recruiting_Stage_ID">REJECTED</wd:ID>
</wd:Stage>
</wd:Job_Application_Process_Statuses_group>
<wd:candidate>C-0000704156</wd:candidate>
<wd:Requisition_ID>R-0000076253</wd:Requisition_ID>
</wd:Report_Entry>
<wd:Report_Entry>
<wd:Job_Requisition_group>
<wd:Is_Evergreen>0</wd:Is_Evergreen>
</wd:Job_Requisition_group>
<wd:Job_Application_Process_Statuses_group>
<wd:Last_Functionally_Updated>2024-12-11T09:41:35.698-08:00</wd:Last_Functionally_Updated>
<wd:Stage wd:Descriptor="Review">
<wd:ID wd:type="WID">31350d72f899430fb446b410c1e368cd</wd:ID>
<wd:ID wd:type="Recruiting_Stage_ID">REVIEW</wd:ID>
</wd:Stage>
</wd:Job_Application_Process_Statuses_group>
<wd:Job_Application_Process_Statuses_group>
<wd:Last_Functionally_Updated>2024-12-11T09:41:54.044-08:00</wd:Last_Functionally_Updated>
<wd:Stage wd:Descriptor="Review">
<wd:ID wd:type="WID">31350d72f899430fb446b410c1e368cd</wd:ID>
<wd:ID wd:type="Recruiting_Stage_ID">REVIEW</wd:ID>
</wd:Stage>
</wd:Job_Application_Process_Statuses_group>
<wd:Job_Application_Process_Statuses_group>
<wd:Last_Functionally_Updated>2024-12-11T09:42:50.630-08:00</wd:Last_Functionally_Updated>
<wd:Stage wd:Descriptor="Screen">
<wd:ID wd:type="WID">2d0e4a68825d4d2a8c507af7542d3f15</wd:ID>
<wd:ID wd:type="Recruiting_Stage_ID">SCREEN</wd:ID>
</wd:Stage>
</wd:Job_Application_Process_Statuses_group>
<wd:Job_Application_Process_Statuses_group>
<wd:Last_Functionally_Updated>2024-12-11T09:43:19.091-08:00</wd:Last_Functionally_Updated>
<wd:Stage wd:Descriptor="Screen">
<wd:ID wd:type="WID">2d0e4a68825d4d2a8c507af7542d3f15</wd:ID>
<wd:ID wd:type="Recruiting_Stage_ID">SCREEN</wd:ID>
</wd:Stage>
</wd:Job_Application_Process_Statuses_group>
<wd:Job_Application_Process_Statuses_group>
<wd:Last_Functionally_Updated>2024-12-11T09:43:39.613-08:00</wd:Last_Functionally_Updated>
<wd:Stage wd:Descriptor="Assessment">
<wd:ID wd:type="WID">bb01594c858710000e4d46d2b7220034</wd:ID>
<wd:ID wd:type="Recruiting_Stage_ID">ASSESSMENT</wd:ID>
</wd:Stage>
</wd:Job_Application_Process_Statuses_group>
<wd:Job_Application_Process_Statuses_group>
<wd:Last_Functionally_Updated>2024-12-11T09:45:00.608-08:00</wd:Last_Functionally_Updated>
<wd:Stage wd:Descriptor="Interview">
<wd:ID wd:type="WID">3317e4265cf94b91873b7015881a0e9c</wd:ID>
<wd:ID wd:type="Recruiting_Stage_ID">INTERVIEW</wd:ID>
</wd:Stage>
</wd:Job_Application_Process_Statuses_group>
<wd:Job_Application_Process_Statuses_group>
<wd:Last_Functionally_Updated>2024-12-11T09:52:33.923-08:00</wd:Last_Functionally_Updated>
<wd:Stage wd:Descriptor="Offer (Employment Agreement)">
<wd:ID wd:type="WID">1d57fbe8504d100015945d2b2704006a</wd:ID>
<wd:ID wd:type="Recruiting_Stage_ID">EMPLOYMENT_AGREEMENT</wd:ID>
</wd:Stage>
</wd:Job_Application_Process_Statuses_group>
<wd:Job_Application_Process_Statuses_group>
<wd:Last_Functionally_Updated>2024-12-11T09:56:25.485-08:00</wd:Last_Functionally_Updated>
<wd:Stage wd:Descriptor="Background Check">
<wd:ID wd:type="WID">be56571f9f6f45ca82871c8bec853f5e</wd:ID>
<wd:ID wd:type="Recruiting_Stage_ID">BACKGROUND</wd:ID>
</wd:Stage>
</wd:Job_Application_Process_Statuses_group>
<wd:Job_Application_Process_Statuses_group>
<wd:Last_Functionally_Updated>2024-12-11T09:56:25.485-08:00</wd:Last_Functionally_Updated>
<wd:Stage wd:Descriptor="Ready for Hire">
<wd:ID wd:type="WID">edd55803e2ec49c3a6eb01daadfc9bf9</wd:ID>
<wd:ID wd:type="Recruiting_Stage_ID">HIRED</wd:ID>
</wd:Stage>
</wd:Job_Application_Process_Statuses_group>
<wd:candidate>C-0001721053</wd:candidate>
<wd:Requisition_ID>R-0000106433</wd:Requisition_ID>
</wd:Report_Entry>
<wd:Report_Entry>
<wd:Job_Requisition_group>
<wd:Is_Evergreen>1</wd:Is_Evergreen>
</wd:Job_Requisition_group>
<wd:Job_Application_Process_Statuses_group>
<wd:Last_Functionally_Updated>2024-12-10T12:15:30.187-08:00</wd:Last_Functionally_Updated>
<wd:Stage wd:Descriptor="Review">
<wd:ID wd:type="WID">31350d72f899430fb446b410c1e368cd</wd:ID>
<wd:ID wd:type="Recruiting_Stage_ID">REVIEW</wd:ID>
</wd:Stage>
</wd:Job_Application_Process_Statuses_group>
<wd:Job_Application_Process_Statuses_group>
<wd:Last_Functionally_Updated>2024-12-10T12:15:49.308-08:00</wd:Last_Functionally_Updated>
<wd:Stage wd:Descriptor="Interview">
<wd:ID wd:type="WID">3317e4265cf94b91873b7015881a0e9c</wd:ID>
<wd:ID wd:type="Recruiting_Stage_ID">INTERVIEW</wd:ID>
</wd:Stage>
</wd:Job_Application_Process_Statuses_group>
<wd:Job_Application_Process_Statuses_group>
<wd:Last_Functionally_Updated>2024-12-10T12:15:49.308-08:00</wd:Last_Functionally_Updated>
<wd:Stage wd:Descriptor="Offer">
<wd:ID wd:type="WID">868a8156682541f2aadc2fe90268b75f</wd:ID>
<wd:ID wd:type="Recruiting_Stage_ID">OFFER</wd:ID>
</wd:Stage>
</wd:Job_Application_Process_Statuses_group>
<wd:candidate>C-0001721051</wd:candidate>
<wd:Requisition_ID>R-0000098017</wd:Requisition_ID>
</wd:Report_Entry>
<wd:Report_Entry>
<wd:Job_Requisition_group>
<wd:Is_Evergreen>1</wd:Is_Evergreen>
</wd:Job_Requisition_group>
<wd:Job_Application_Process_Statuses_group>
<wd:Last_Functionally_Updated>2024-12-12T11:52:49.381-08:00</wd:Last_Functionally_Updated>
<wd:Stage wd:Descriptor="Review">
<wd:ID wd:type="WID">31350d72f899430fb446b410c1e368cd</wd:ID>
<wd:ID wd:type="Recruiting_Stage_ID">REVIEW</wd:ID>
</wd:Stage>
</wd:Job_Application_Process_Statuses_group>
<wd:Job_Application_Process_Statuses_group>
<wd:Last_Functionally_Updated>2024-12-12T11:52:49.381-08:00</wd:Last_Functionally_Updated>
<wd:Stage wd:Descriptor="Interview">
<wd:ID wd:type="WID">3317e4265cf94b91873b7015881a0e9c</wd:ID>
<wd:ID wd:type="Recruiting_Stage_ID">INTERVIEW</wd:ID>
</wd:Stage>
</wd:Job_Application_Process_Statuses_group>
<wd:candidate>C-0001721060</wd:candidate>
<wd:Requisition_ID>R-0000103689</wd:Requisition_ID>
</wd:Report_Entry>
<wd:Report_Entry>
<wd:Job_Requisition_group>
<wd:Is_Evergreen>1</wd:Is_Evergreen>
</wd:Job_Requisition_group>
<wd:Job_Application_Process_Statuses_group>
<wd:Last_Functionally_Updated>2024-12-12T11:52:49.381-08:00</wd:Last_Functionally_Updated>
<wd:Stage wd:Descriptor="Review">
<wd:ID wd:type="WID">31350d72f899430fb446b410c1e368cd</wd:ID>
<wd:ID wd:type="Recruiting_Stage_ID">REVIEW</wd:ID>
</wd:Stage>
</wd:Job_Application_Process_Statuses_group>
<wd:Job_Application_Process_Statuses_group>
<wd:Last_Functionally_Updated>2024-12-12T11:52:49.381-08:00</wd:Last_Functionally_Updated>
<wd:Stage wd:Descriptor="Interview">
<wd:ID wd:type="WID">3317e4265cf94b91873b7015881a0e9c</wd:ID>
<wd:ID wd:type="Recruiting_Stage_ID">INTERVIEW</wd:ID>
</wd:Stage>
</wd:Job_Application_Process_Statuses_group>
<wd:candidate>C-0001721060</wd:candidate>
<wd:Requisition_ID>R-0000103689</wd:Requisition_ID>
</wd:Report_Entry>
<wd:Report_Entry>
<wd:Job_Requisition_group>
<wd:Is_Evergreen>1</wd:Is_Evergreen>
</wd:Job_Requisition_group>
<wd:Job_Application_Process_Statuses_group>
<wd:Last_Functionally_Updated>2024-12-16T09:52:14.424-08:00</wd:Last_Functionally_Updated>
<wd:Stage wd:Descriptor="Review">
<wd:ID wd:type="WID">31350d72f899430fb446b410c1e368cd</wd:ID>
<wd:ID wd:type="Recruiting_Stage_ID">REVIEW</wd:ID>
</wd:Stage>
</wd:Job_Application_Process_Statuses_group>
<wd:Job_Application_Process_Statuses_group>
<wd:Last_Functionally_Updated>2024-12-16T09:52:14.424-08:00</wd:Last_Functionally_Updated>
<wd:Stage wd:Descriptor="Rejected">
<wd:ID wd:type="WID">9a35fa5882c24620a777de1dbcf34d3c</wd:ID>
<wd:ID wd:type="Recruiting_Stage_ID">REJECTED</wd:ID>
</wd:Stage>
</wd:Job_Application_Process_Statuses_group>
<wd:candidate>C-0001721062</wd:candidate>
<wd:Requisition_ID>R-0000086280</wd:Requisition_ID>
</wd:Report_Entry>
<wd:Report_Entry>
<wd:Job_Requisition_group>
<wd:Is_Evergreen>1</wd:Is_Evergreen>
</wd:Job_Requisition_group>
<wd:Job_Application_Process_Statuses_group>
<wd:Last_Functionally_Updated>2024-12-17T22:12:11.799-08:00</wd:Last_Functionally_Updated>
<wd:Stage wd:Descriptor="Review">
<wd:ID wd:type="WID">31350d72f899430fb446b410c1e368cd</wd:ID>
<wd:ID wd:type="Recruiting_Stage_ID">REVIEW</wd:ID>
</wd:Stage>
</wd:Job_Application_Process_Statuses_group>
<wd:candidate>C-0001721063</wd:candidate>
<wd:Requisition_ID>R-0000085728</wd:Requisition_ID>
</wd:Report_Entry>
</wd:Report_Data>
我当前的 xslt 正在做我需要它做的事情,但是,我想添加 1 个逻辑,如果
<wd:Is_Evergreen>
不等于 0(例如,如果它等于 1),则忽略 <wd:Report_Entry>
。基本上我希望我的 xslt 跳过任何 <wd:Report_Entry>
它的 <wd:Is_Evergreen>
不等于 0。
我认为这可以简单地使用
<xsl:if>
来完成,所以我尝试在 for-each 之后添加 <xsl:if test="../wd:Job_Requisition_group/wd:Is_Evergreen = '0'">
,但它不起作用,根本没有输出
下面是我的 xslt,我试图在其中添加此过滤器逻辑
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:wd="urn:com.workday.report/INT0194_Recruitics"
exclude-result-prefixes="wd">
<xsl:output method="text" omit-xml-declaration="no"/>
<xsl:variable name="RECORD-DELIMITER">
<xsl:text>
</xsl:text>
</xsl:variable>
<xsl:param name="Dilim">","</xsl:param>
<xsl:param name="Quote">"</xsl:param>
<xsl:param name="Comma">,</xsl:param>
<xsl:variable name="FIELD-DELIMITER">
<xsl:value-of select="$Dilim"/>
</xsl:variable>
<xsl:variable name="STARTING-QUOTE">
<xsl:value-of select="$Quote"/>
</xsl:variable>
<xsl:template match="wd:Report_Data">
<Header>
<HeaderItem1>"time_stamp"</HeaderItem1>
<xsl:value-of select="$Comma"/>
<HeaderItem2>"event"</HeaderItem2>
<xsl:value-of select="$Comma"/>
<HeaderItem3>"applyflow_id"</HeaderItem3>
<xsl:value-of select="$Comma"/>
<HeaderItem4>"job_id"</HeaderItem4>
</Header>
<xsl:value-of select="$RECORD-DELIMITER"/>
<xsl:for-each-group select="wd:Report_Entry/wd:Job_Application_Process_Statuses_group" composite="yes" group-by="../wd:candidate, ../wd:Requisition_ID , wd:Stage/wd:ID">
<xsl:for-each select="(current-group() => sort((), function($j) { $j/wd:Last_Functionally_Updated }))[last()]">
<xsl:value-of select="$STARTING-QUOTE"/>
<time_stamp>
<!--<xsl:value-of select="wd:Last_Functionally_Updated"/>-->
<xsl:value-of select="format-dateTime(wd:Last_Functionally_Updated, '[M01]/[D01]/[Y0001] [H01]:[m01]:[s01]')"/>
</time_stamp>
<xsl:value-of select="$FIELD-DELIMITER"/>
<event>
<xsl:value-of select="wd:Stage/@wd:Descriptor"/>
</event>
<xsl:value-of select="$FIELD-DELIMITER"/>
<applyflow_id>
<xsl:value-of select="../wd:candidate"/>
</applyflow_id>
<xsl:value-of select="$FIELD-DELIMITER"/>
<job_id>
<xsl:value-of select="../wd:Requisition_ID"/>
</job_id>
<xsl:value-of select="$STARTING-QUOTE"/>
<xsl:value-of select="$RECORD-DELIMITER"/>
</xsl:for-each>
</xsl:for-each-group>
</xsl:template>
</xsl:stylesheet>
请让我知道我哪里做错了以及如何正确地做。
代替
select="wd:Report_Entry...
使用 select="wd:Report_Entry[wd:Job_Requisition_group/wd:Is_Evergreen = 0]...