次のxmlが与えられた場合
<Root>
<Employee>
<service>
<Record>xxx</Record>
<Record>yyy</Record>
</service>
<service>
<Record>xxx</Record>
<Record>yyy</Record>
<Record>zzz</Record>
</service>
</Employee>
<Employee>
<service>
<Record>xxx</Record>
<Record>yyy</Record>
</service>
<service>
<Record>xxx</Record>
<Record>yyy</Record>
<Record>zzz</Record>
</service>
</Employee>
</Root>
XSLT1.0 を使用して、「xxx」、「yyy」、「zzz」を含む各フィールドの xml を変換する際<Employee>に<Record>、結果に 1 回だけ出現する必要があります。
<Root>
<Employee>
<Service>
<Record>xxx</Record>
<Record>yyy</Record>
<Record>zzz</Record>
</Service>
</Employee>
<Employee>
<Service>
<Record>xxx</Record>
<Record>yyy</Record>
<Record>zzz</Record>
<Service>
</Employee>
</Root>
Employee の for-each ループで、 の使用に疲れ<xsl:if test='not(preceding::./service/Record=$record)'>ました。テストは、'xxx','yyy','zzz' を 1 回だけ実行する最初のテストで正常に機能し<Employee>ます<Record>。反復が次に進むと<Employee>、テスト条件<Record>は最初の値<Employee>もチェックし、値「xxx」、「yyy」、「zzz」を持つ先行ノードがすでに存在することを検出するため、レコードを取得できません2番目<Employee>。<Record>2 番目の sを取得する方法<Employee>。どんな助けでも大歓迎です。
ありがとう