【发布时间】:2022-01-19 23:32:25
【问题描述】:
我有一个包含多个节点的 XML - 'ns:Student_Files_Grouping',我需要删除最新的节点(每个节点内都有日期时间戳)
您能否帮助我如何使用 XSLT 2.0 / XSLT 3.0 实现这一目标? 我正在慢慢开始编写 XSLT,因此请求一些帮助。
请参阅下面需要由 XSLT 处理的 XML:
<?xml version='1.0' encoding='UTF-8'?>
<ns:Root xmlns:ns="java">
<ns:Data>
<ns:Name ns:Descriptor="John Doe">
<ns:ID ns:type="STID">1088dd20469510fee9889ce8087f0d05</ns:ID>
<ns:ID ns:type="School_ID">76512</ns:ID>
</ns:Name>
<ns:School_ID>76512</ns:School_ID>
<ns:Student_Files_Grouping>
<ns:STUDENT_DOCUMENT ns:Descriptor="John_Doe_Notice.pdf">
<ns:ID ns:type="STID">c42558614694014f1d0cef5b87014a77</ns:ID>
<ns:ID ns:type="File_ID">STUDENT_DOCUMENT-3-497240</ns:ID>
</ns:STUDENT_DOCUMENT>
<ns:Doc_Category ns:Descriptor="Student Notices">
<ns:ID ns:type="STID">692302db2a6e0120acc3df907c01b301</ns:ID>
<ns:ID ns:type="Document_Category_ID">Student_Notice</ns:ID>
</ns:Doc_Category>
<ns:FileName>John_Doe_Notice.pdf</ns:FileName>
<ns:ReferenceID>STUDENT_DOCUMENT-3-497240</ns:ReferenceID>
<ns:Upload_Date>2021-03-31T23:35:09-07:00</ns:Upload_Date>
</ns:Student_Files_Grouping>
**<ns:Student_Files_Grouping>
<ns:STUDENT_DOCUMENT ns:Descriptor="John_Doe_Notice.pdf">
<ns:ID ns:type="STID">8c8c2a3ebdfb01eecf731df6ea009c3b</ns:ID>
<ns:ID ns:type="File_ID">STUDENT_DOCUMENT-3-498175</ns:ID>
</ns:STUDENT_DOCUMENT>
<ns:Doc_Category ns:Descriptor="Student Notices">
<ns:ID ns:type="STID">692302db2a6e0120acc3df907c01b301</ns:ID>
<ns:ID ns:type="Document_Category_ID">Student_Notice</ns:ID>
</ns:Doc_Category>
<ns:FileName>John_Doe_Notice.pdf</ns:FileName>
<ns:ReferenceID>STUDENT_DOCUMENT-3-498175</ns:ReferenceID>
<ns:Upload_Date>2021-07-07T23:28:05-07:00</ns:Upload_Date>
</ns:Student_Files_Grouping>**
<ns:Student_Files_Grouping>
<ns:STUDENT_DOCUMENT ns:Descriptor="John_Doe_Notice.pdf">
<ns:ID ns:type="STID">122144adf33d01e598738c0b88012b7d</ns:ID>
<ns:ID ns:type="File_ID">STUDENT_DOCUMENT-3-516532</ns:ID>
</ns:STUDENT_DOCUMENT>
<ns:Doc_Category ns:Descriptor="Student Notices">
<ns:ID ns:type="STID">692302db2a6e0120acc3df907c01b301</ns:ID>
<ns:ID ns:type="Document_Category_ID">Student_Notice</ns:ID>
</ns:Doc_Category>
<ns:FileName>John_Doe_Notice.pdf</ns:FileName>
<ns:ReferenceID>STUDENT_DOCUMENT-3-516532</ns:ReferenceID>
<ns:Upload_Date>2021-07-07T23:27:45-07:00</ns:Upload_Date>
</ns:Student_Files_Grouping>
</ns:Data>
</ns:Root>
我需要它,如下所示。不同之处在于节点 - 'ns:Student_Files_Grouping' 具有“ns:Upload_Date”的最新日期时间戳。
<?xml version='1.0' encoding='UTF-8'?>
<ns:Root xmlns:ns="java">
<ns:Data>
<ns:Name ns:Descriptor="John Doe">
<ns:ID ns:type="STID">1088dd20469510fee9889ce8087f0d05</ns:ID>
<ns:ID ns:type="School_ID">76512</ns:ID>
</ns:Name>
<ns:School_ID>76512</ns:School_ID>
<ns:Student_Files_Grouping>
<ns:STUDENT_DOCUMENT ns:Descriptor="John_Doe_Notice.pdf">
<ns:ID ns:type="STID">c42558614694014f1d0cef5b87014a77</ns:ID>
<ns:ID ns:type="File_ID">STUDENT_DOCUMENT-3-497240</ns:ID>
</ns:STUDENT_DOCUMENT>
<ns:Doc_Category ns:Descriptor="Student Notices">
<ns:ID ns:type="STID">692302db2a6e0120acc3df907c01b301</ns:ID>
<ns:ID ns:type="Document_Category_ID">Student_Notice</ns:ID>
</ns:Doc_Category>
<ns:FileName>John_Doe_Notice.pdf</ns:FileName>
<ns:ReferenceID>STUDENT_DOCUMENT-3-497240</ns:ReferenceID>
<ns:Upload_Date>2021-03-31T23:35:09-07:00</ns:Upload_Date>
</ns:Student_Files_Grouping>
<ns:Student_Files_Grouping>
<ns:STUDENT_DOCUMENT ns:Descriptor="John_Doe_Notice.pdf">
<ns:ID ns:type="STID">122144adf33d01e598738c0b88012b7d</ns:ID>
<ns:ID ns:type="File_ID">STUDENT_DOCUMENT-3-516532</ns:ID>
</ns:STUDENT_DOCUMENT>
<ns:Doc_Category ns:Descriptor="Student Notices">
<ns:ID ns:type="STID">692302db2a6e0120acc3df907c01b301</ns:ID>
<ns:ID ns:type="Document_Category_ID">Student_Notice</ns:ID>
</ns:Doc_Category>
<ns:FileName>John_Doe_Notice.pdf</ns:FileName>
<ns:ReferenceID>STUDENT_DOCUMENT-3-516532</ns:ReferenceID>
<ns:Upload_Date>2021-07-07T23:27:45-07:00</ns:Upload_Date>
</ns:Student_Files_Grouping>
</ns:Data>
</ns:Root>
请帮忙!
谢谢大家!
【问题讨论】:
标签: xml xslt xslt-2.0 xslt-3.0 workday-api