XML からのデータが以下のような状況があります。このデータは、以下の入力 XML の後に示される形式である必要があります
**Input XML:-**
<JLINKMetadata>
<photos>
<EventNumber>
<string>120423007237</string>
<string>120602009897</string>
<string>071030-3242</string>
<string>071022-2374</string>
<string>071010-2484</string>
<string>071018-2894</string>
</EventNumber>
<EventDate>
<dateTime>2012-04-23T06:27:00</dateTime>
<dateTime>2012-06-02T18:53:00</dateTime>
<dateTime>2007-10-30T20:35:00</dateTime>
<dateTime>2007-10-22T16:45:00</dateTime>
<dateTime>2007-10-10T16:50:00</dateTime>
<dateTime>2007-10-18T19:40:00</dateTime>
</EventDate>
<DOB>
<dateTime>1965-07-08T00:00:00</dateTime>
<dateTime>1965-07-08T00:00:00</dateTime>
<dateTime>1965-07-08T00:00:00</dateTime>
<dateTime>1965-07-08T00:00:00</dateTime>
<dateTime>1965-07-08T00:00:00</dateTime>
<dateTime>1965-07-08T00:00:00</dateTime>
</DOB>
</photos>
</JLINKMetadata>
以下は、上記の XML データが必要な既存の XSLT 形式です。
<PersonPhoto>
<!--PersonPhotos.EventNumber-->
<EventIdentification>
<IdentificationID>EVT12345</IdentificationID>
</EventIdentification>
<EventDate>
<!--PersonPhotos.EventDate-->
<Date>2007-02-20</:Date>
</EventDate>
<PersonBirthDate>
<!--PersonPhotos.BirthDate-->
<Date>1981-02-20</Date>
</PersonBirthDate>
</PersonPhoto>
これが私が最終的に望んでいた出力XMLです:-
<Photos>
<PersonPhoto>
<EventIdentification>
<IdentificationID>120423007237</IdentificationID>
</EventIdentification>
<EventDate>
<Date>04/23/2012</Date>
</EventDate>
<PersonBirthDate>
<Date>7/8/1965</Date>
</PersonBirthDate>
</PersonPhoto>
<PersonPhoto>
<EventIdentification>
<IdentificationID>120602009897</IdentificationID>
</EventIdentification>
<EventDate>
<Date>10/22/2007</Date>
</EventDate>
<PersonBirthDate>
<Date>11/6/1945</Date>
</PersonBirthDate>
</PersonPhoto>
<PersonPhoto>
<EventIdentification>
<IdentificationID>120602009897</IdentificationID>
</EventIdentification>
<EventDate>
<Date>5/12/2011</Date>
</EventDate>
<PersonBirthDate>
<Date>1/3/1955</Date>
</PersonBirthDate>
</PersonPhoto>
</Photos>
前もって感謝します..誰かがこの状況で私を助けてくれることを願っています...
これが私がこれまでに試したことです..そして、上記の予想される出力xmlに示されているPersonPhotoのレコードを1つだけ生成しました..私の目的は、発生が動的であるすべてのレコードをキャプチャすることです
<xsl:variable name="Photos" select="photos"/>
<xsl:for-each select="$Photos">
<PersonPhoto>
<!--PersonPhotos.EventNumber-->
<EventIdentification>
<IdentificationID>
<xsl:value-of select="EventNumber/string" />
</IdentificationID>
</EventIdentification>
<EventDate>
<!--PersonPhotos.EventDate-->
<Date>
<xsl:value-of select="EventDate/dateTime" />
</Date>
</EventDate>
<PersonBirthDate>
<!--PersonPhotos.BirthDate-->
<Date>
<xsl:value-of select="DOB/dateTime" />
</Date>
</PersonBirthDate>
</PersonPhoto>