我正在尝试使用 XSLT 将 XML 转换为 XML。输出 XML 应根据输入 XML 中的 ModificationTime 元素进行排序。下面是xml代码。
<?xml version="1.0" encoding="UTF-8"?>
<Process>
<currentDayAndHour>@Fri16</currentDayAndHour>
<!-- Few elements here. Need to retain them -->
<rowCount>1</rowCount>
<currentRow>1</currentRow>
<ClientList>
<Status>0</Status>
<ServerResponse>
<Code>0</Code>
<Text>OK</Text>
</ServerResponse>
<ServiceStartTime>2012-11-09 16:06:42.786</ServiceStartTime>
<ServiceEndTime>2012-11-09 16:06:42.827</ServiceEndTime>
<Files>
<File>
<Name>test.20121107215230411.txt</Name>
<Size>29</Size>
<Type>Regular</Type>
<Permissions>-rw-r--r--</Permissions>
<ModificationTime>1352343152</ModificationTime>
<Owner>19737</Owner>
<Group>70902</Group>
</File>
<File>
<Name>test.20121107183757513.txt</Name>
<Size>29</Size>
<Type>Regular</Type>
<Permissions>-rw-r--r--</Permissions>
<ModificationTime>1352331478</ModificationTime>
<Owner>19737</Owner>
<Group>70902</Group>
</File>
<File>
<Name>test1.20121107215230500.txt</Name>
<Size>32</Size>
<Type>Regular</Type>
<Permissions>-rw-r--r--</Permissions>
<ModificationTime>1352343152</ModificationTime>
<Owner>19737</Owner>
<Group>70902</Group>
</File>
<File>
<Name>test1.txt</Name>
<Size>32</Size>
<Type>Regular</Type>
<Permissions>-rw-r--r--</Permissions>
<ModificationTime>1352323788</ModificationTime>
<Owner>65174</Owner>
<Group>75431</Group>
</File>
<File>
<Name>HMP_test.txt</Name>
<Size>28</Size>
<Type>Regular</Type>
<Permissions>-rw-r--r--</Permissions>
<ModificationTime>1352199478</ModificationTime>
<Owner>19737</Owner>
<Group>70902</Group>
</File>
<File>
<Name>test1.20121107183757585.txt</Name>
<Size>32</Size>
<Type>Regular</Type>
<Permissions>-rw-r--r--</Permissions>
<ModificationTime>1352331478</ModificationTime>
<Owner>19737</Owner>
<Group>70902</Group>
</File>
<File>
<Name>client_access.20121108101411179.txt</Name>
<Size>4182</Size>
<Type>Regular</Type>
<Permissions>-rw-r--r--</Permissions>
<ModificationTime>1352387653</ModificationTime>
<Owner>19737</Owner>
<Group>70902</Group>
</File>
<File>
<Name>TechMtngAgenda.txt</Name>
<Size>107</Size>
<Type>Regular</Type>
<Permissions>-rw-r--r--</Permissions>
<ModificationTime>1352044842</ModificationTime>
<Owner>19737</Owner>
<Group>70902</Group>
</File>
<File>
<Name>test.txt</Name>
<Size>29</Size>
<Type>Regular</Type>
<Permissions>-rw-r--r--</Permissions>
<ModificationTime>1350063313</ModificationTime>
<Owner>19737</Owner>
<Group>70902</Group>
</File>
</Files>
</ClientList>
<currentDocument>1</currentDocument>
</Process>
我需要包含所有输入元素的输出 XML,但 Files 标记应按 ModificationTime 的递增顺序包含每个文件。我对 XSLT 有点陌生。我尝试使用 xsl:sort 但无法获得所需的结果。