我是XSLT的新手。请帮我解决一下这个。 通过字段FORNAMN Ascending的ValidFrom为每个同事排序EmploymentUpdateRequests,并在XML文件中写入EmploymentUpdateRequests。
我只能根据员工编号进行排序,该编号将按顺序对所有相同的员工编号进行分组,但无法使用xslt按升序进行进一步的排序。
请帮忙。
Input XML:
<EmploymentUpdateRequests>
<EmploymentUpdateRequest>
<CompanyNo>0017</CompanyNo>
<EmploymentNo>020410</EmploymentNo>
<Fields>
<FieldValue Name="EmpFrom" Type="Date">
<ValidFrom Format="yyyy-MM-dd">2016-10-19</ValidFrom>
<ValidUntil Format="yyyy-MM-dd">2016-10-18</ValidUntil>
<Value Format="yyyy-MM-dd">2016-10-19</Value>
</FieldValue>
<FieldValue Name="FORNAMN" Type="String">
<ValidFrom Format="yyyy-MM-dd">2016-10-19</ValidFrom>
<ValidUntil Format="yyyy-MM-dd">2016-10-18</ValidUntil>
<Value>Nicoleta Geta</Value>
</FieldValue>
<FieldValue Name="EFTERNAMN" Type="String">
<ValidFrom Format="yyyy-MM-dd">2016-10-19</ValidFrom>
<ValidUntil Format="yyyy-MM-dd">2016-10-18</ValidUntil>
<Value>Juenker Roberts</Value>
</FieldValue>
<FieldValue Name="LANGUAGE" Type="String">
<ValidFrom Format="yyyy-MM-dd">2016-10-19</ValidFrom>
<ValidUntil Format="yyyy-MM-dd">2016-10-18</ValidUntil>
<Value>el</Value>
</FieldValue>
</Fields>
</EmploymentUpdateRequest>
<EmploymentUpdateRequest>
<CompanyNo>0017</CompanyNo>
<EmploymentNo>020413</EmploymentNo>
<Fields>
<FieldValue Name="EmpFrom" Type="Date">
<ValidFrom Format="yyyy-MM-dd">2016-10-19</ValidFrom>
<ValidUntil Format="yyyy-MM-dd">2099-12-31</ValidUntil>
<Value Format="yyyy-MM-dd">2016-10-19</Value>
</FieldValue>
<FieldValue Name="FORNAMN" Type="String">
<ValidFrom Format="yyyy-MM-dd">2016-10-19</ValidFrom>
<ValidUntil Format="yyyy-MM-dd">2099-12-31</ValidUntil>
<Value>Nicoleta Geta</Value>
</FieldValue>
<FieldValue Name="EFTERNAMN" Type="String">
<ValidFrom Format="yyyy-MM-dd">2016-10-19</ValidFrom>
<ValidUntil Format="yyyy-MM-dd">2099-12-31</ValidUntil>
<Value>Juenker Roberts</Value>
</FieldValue>
</Fields>
</EmploymentUpdateRequest>
<EmploymentUpdateRequest>
<CompanyNo>0017</CompanyNo>
<EmploymentNo>020413</EmploymentNo>
<Fields>
<FieldValue Name="EmpFrom" Type="Date">
<ValidFrom Format="yyyy-MM-dd">2016-11-29</ValidFrom>
<ValidUntil Format="yyyy-MM-dd">2099-12-31</ValidUntil>
<Value Format="yyyy-MM-dd">2016-11-29</Value>
</FieldValue>
<FieldValue Name="FORNAMN" Type="String">
<ValidFrom Format="yyyy-MM-dd">2016-11-29</ValidFrom>
<ValidUntil Format="yyyy-MM-dd">2099-12-31</ValidUntil>
<Value>Nicoleta Geta</Value>
</FieldValue>
<FieldValue Name="EFTERNAMN" Type="String">
<ValidFrom Format="yyyy-MM-dd">2016-11-29</ValidFrom>
<ValidUntil Format="yyyy-MM-dd">2099-12-31</ValidUntil>
<Value>Juenker Robert</Value>
</FieldValue>
</Fields>
</EmploymentUpdateRequest>
<EmploymentUpdateRequest>
<CompanyNo>0017</CompanyNo>
<EmploymentNo>020410</EmploymentNo>
<Fields>
<FieldValue Name="EmpFrom" Type="Date">
<ValidFrom Format="yyyy-MM-dd">2016-12-18</ValidFrom>
<ValidUntil Format="yyyy-MM-dd">2016-12-17</ValidUntil>
<Value Format="yyyy-MM-dd">2016-12-18</Value>
</FieldValue>
<FieldValue Name="FORNAMN" Type="String">
<ValidFrom Format="yyyy-MM-dd">2016-12-18</ValidFrom>
<ValidUntil Format="yyyy-MM-dd">2016-12-17</ValidUntil>
<Value>Nicoleta Geta</Value>
</FieldValue>
<FieldValue Name="EFTERNAMN" Type="String">
<ValidFrom Format="yyyy-MM-dd">2016-12-18</ValidFrom>
<ValidUntil Format="yyyy-MM-dd">2016-12-17</ValidUntil>
<Value>Juenker Roberts</Value>
</FieldValue>
</Fields>
</EmploymentUpdateRequest>
<EmploymentUpdateRequest>
<CompanyNo>0017</CompanyNo>
<EmploymentNo>020410</EmploymentNo>
<Fields>
<FieldValue Name="EmpFrom" Type="Date">
<ValidFrom Format="yyyy-MM-dd">2016-01-19</ValidFrom>
<ValidUntil Format="yyyy-MM-dd">2016-01-18</ValidUntil>
<Value Format="yyyy-MM-dd">2016-10-19</Value>
</FieldValue>
<FieldValue Name="FORNAMN" Type="String">
<ValidFrom Format="yyyy-MM-dd">2016-01-19</ValidFrom>
<ValidUntil Format="yyyy-MM-dd">2016-01-18</ValidUntil>
<Value>Nicoleta Geta</Value>
</FieldValue>
<FieldValue Name="EFTERNAMN" Type="String">
<ValidFrom Format="yyyy-MM-dd">2016-01-19</ValidFrom>
<ValidUntil Format="yyyy-MM-dd">2016-01-18</ValidUntil>
<Value>Juenker Roberts</Value>
</FieldValue>
</Fields>
</EmploymentUpdateRequest>
</EmploymentUpdateRequests>
预期产出:
<EmploymentUpdateRequests>
<EmploymentUpdateRequest>
<CompanyNo>0017</CompanyNo>
<EmploymentNo>020410</EmploymentNo>
<Fields>
<FieldValue Name="EmpFrom" Type="Date">
<ValidFrom Format="yyyy-MM-dd">2016-01-19</ValidFrom>
<ValidUntil Format="yyyy-MM-dd">2016-01-18</ValidUntil>
<Value Format="yyyy-MM-dd">2016-10-19</Value>
</FieldValue>
<FieldValue Name="FORNAMN" Type="String">
<ValidFrom Format="yyyy-MM-dd">2016-01-19</ValidFrom>
<ValidUntil Format="yyyy-MM-dd">2016-01-18</ValidUntil>
<Value>Nicoleta Geta</Value>
</FieldValue>
<FieldValue Name="EFTERNAMN" Type="String">
<ValidFrom Format="yyyy-MM-dd">2016-01-19</ValidFrom>
<ValidUntil Format="yyyy-MM-dd">2016-01-18</ValidUntil>
<Value>Juenker Roberts</Value>
</FieldValue>
</Fields>
</EmploymentUpdateRequest>
<EmploymentUpdateRequest>
<CompanyNo>0017</CompanyNo>
<EmploymentNo>020410</EmploymentNo>
<Fields>
<FieldValue Name="EmpFrom" Type="Date">
<ValidFrom Format="yyyy-MM-dd">2016-10-19</ValidFrom>
<ValidUntil Format="yyyy-MM-dd">2016-10-18</ValidUntil>
<Value Format="yyyy-MM-dd">2016-10-19</Value>
</FieldValue>
<FieldValue Name="FORNAMN" Type="String">
<ValidFrom Format="yyyy-MM-dd">2016-10-19</ValidFrom>
<ValidUntil Format="yyyy-MM-dd">2016-10-18</ValidUntil>
<Value>Nicoleta Geta</Value>
</FieldValue>
<FieldValue Name="EFTERNAMN" Type="String">
<ValidFrom Format="yyyy-MM-dd">2016-10-19</ValidFrom>
<ValidUntil Format="yyyy-MM-dd">2016-10-18</ValidUntil>
<Value>Juenker Roberts</Value>
</FieldValue>
<FieldValue Name="LANGUAGE" Type="String">
<ValidFrom Format="yyyy-MM-dd">2016-10-19</ValidFrom>
<ValidUntil Format="yyyy-MM-dd">2016-10-18</ValidUntil>
<Value>el</Value>
</FieldValue>
</Fields>
</EmploymentUpdateRequest>
<EmploymentUpdateRequest>
<CompanyNo>0017</CompanyNo>
<EmploymentNo>020410</EmploymentNo>
<Fields>
<FieldValue Name="EmpFrom" Type="Date">
<ValidFrom Format="yyyy-MM-dd">2016-12-18</ValidFrom>
<ValidUntil Format="yyyy-MM-dd">2016-12-17</ValidUntil>
<Value Format="yyyy-MM-dd">2016-12-18</Value>
</FieldValue>
<FieldValue Name="FORNAMN" Type="String">
<ValidFrom Format="yyyy-MM-dd">2016-12-18</ValidFrom>
<ValidUntil Format="yyyy-MM-dd">2016-12-17</ValidUntil>
<Value>Nicoleta Geta</Value>
</FieldValue>
<FieldValue Name="EFTERNAMN" Type="String">
<ValidFrom Format="yyyy-MM-dd">2016-12-18</ValidFrom>
<ValidUntil Format="yyyy-MM-dd">2016-12-17</ValidUntil>
<Value>Juenker Roberts</Value>
</FieldValue>
</Fields>
</EmploymentUpdateRequest>
<EmploymentUpdateRequest>
<CompanyNo>0017</CompanyNo>
<EmploymentNo>020413</EmploymentNo>
<Fields>
<FieldValue Name="EmpFrom" Type="Date">
<ValidFrom Format="yyyy-MM-dd">2016-10-19</ValidFrom>
<ValidUntil Format="yyyy-MM-dd">2099-12-31</ValidUntil>
<Value Format="yyyy-MM-dd">2016-10-19</Value>
</FieldValue>
<FieldValue Name="FORNAMN" Type="String">
<ValidFrom Format="yyyy-MM-dd">2016-10-19</ValidFrom>
<ValidUntil Format="yyyy-MM-dd">2099-12-31</ValidUntil>
<Value>Nicoleta Geta</Value>
</FieldValue>
<FieldValue Name="EFTERNAMN" Type="String">
<ValidFrom Format="yyyy-MM-dd">2016-10-19</ValidFrom>
<ValidUntil Format="yyyy-MM-dd">2099-12-31</ValidUntil>
<Value>Juenker Roberts</Value>
</FieldValue>
</Fields>
</EmploymentUpdateRequest>
<EmploymentUpdateRequest>
<CompanyNo>0017</CompanyNo>
<EmploymentNo>020413</EmploymentNo>
<Fields>
<FieldValue Name="EmpFrom" Type="Date">
<ValidFrom Format="yyyy-MM-dd">2016-11-29</ValidFrom>
<ValidUntil Format="yyyy-MM-dd">2099-12-31</ValidUntil>
<Value Format="yyyy-MM-dd">2016-11-29</Value>
</FieldValue>
<FieldValue Name="FORNAMN" Type="String">
<ValidFrom Format="yyyy-MM-dd">2016-11-29</ValidFrom>
<ValidUntil Format="yyyy-MM-dd">2099-12-31</ValidUntil>
<Value>Nicoleta Geta</Value>
</FieldValue>
<FieldValue Name="EFTERNAMN" Type="String">
<ValidFrom Format="yyyy-MM-dd">2016-11-29</ValidFrom>
<ValidUntil Format="yyyy-MM-dd">2099-12-31</ValidUntil>
<Value>Juenker Robert</Value>
</FieldValue>
</Fields>
</EmploymentUpdateRequest>
</EmploymentUpdateRequests>
此xml需要按照上例中的预期方式进行排序。有些人请为此分享xslt样本。
答案 0 :(得分:2)
connectionString