我有来自 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>
在此先感谢..希望有人可以帮助我解决这种情况...
这是我到目前为止所尝试的......并且只产生了 1 条 PersonPhoto 记录,显示在上面的预期输出 xml 中......我的目标是捕获每条出现动态的记录
<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>