RE: [xsl] Looping through multiple elements

Subject: RE: [xsl] Looping through multiple elements
From: "Jones Mark Mr \(ITCS\)" <Mark.Jones@xxxxxxxxx>
Date: Tue, 18 Mar 2008 17:10:34 -0000
Hi,

Cheers for all your help. Below and attached is the xml file that the
system outputs by default. So I think I need to loop to make a list of
elements - one for each item of metadata.

Mark Jones


####
<record>
	<header>
		<datestamp>2008-03-13T13:49:55Z</datestamp>
		<setSpec>oai</setSpec>
	</header>
<metadata>
	<xb:digital_entity>
		<pid>5555</pid>
			<mds>
			<md shared="false">
			<mid>8207</mid>
			<description xsi:nil="true"/>
			<name>descriptive</name>
			<type>dc</type>
			<value>
				<record
xmlns:dc="http://purl.org/dc/elements/1.1/";
xmlns:dcterms="http://purl.org/dc/terms/";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
				<dc:ueainstitution>University of East
Anglia</dc:ueainstitution>
				<dc:ueafaculty>Health</dc:ueafaculty>
				<dc:ueaschool>Allied Health
Professions</dc:ueaschool>

<dc:uearaesubmission2008>True</dc:uearaesubmission2008>
				<dc:ueastatus>post-print
formatted</dc:ueastatus>

<dc:ueaunitofassessment>12</dc:ueaunitofassessment>

<dc:ueahesastaffidentifier>0611176310473</dc:ueahesastaffidentifier>
				<dc:creator>Hartley, S. D.</dc:creator>
				<dc:creatorid>wo203</dc:creatorid>
				<dc:type
xsi:type="dcterms:JournalArticle">Journal article</dc:type>
				<dc:title>Attitudes and practices of
families and health care personnel toward children with epilepsy in
Kilifi, Kenya</dc:title>
				<dc:ueavolume>8 (1)</dc:ueavolume>

<dc:ueapagination>201-212</dc:ueapagination>
				<dc:ueajournal>Epilepsy &amp;
Behaviour</dc:ueajournal>
				<dc:identifier
xsi:type="dcterms:ISSN">1525-5069</dc:identifier>
				<dc:date>2006</dc:date>

<dc:date.created>01/02/2006</dc:date.created>
				<dc:identifier
xsi:type="dcterms:URI">http://dx.doi.org/101016/j.yebeh.2005.09.011</dc:
identifier>
				<dc:creator1>El Sharkaway,
G.</dc:creator1>
				<dc:creator1id>n465</dc:creator1id>
				<dc:creator2>Newton, C.</dc:creator2>
				<dc:creator2id>t657</dc:creator2id>
				<dc:creatorall>Hartley, S. D. ; El
Sharkaway, G. ; Newton, C.</dc:creatorall></record>
			</value>
			</md>
			<md shared="false">
			<mid>8208</mid>
			<description xsi:nil="true"/>
			<name>changehistory</name>
			<type>changehistory_md</type>
			<value><xb:history
xmlns:xb="http://com/exlibris/digitool/repository/api/xmlbeans";><events>
<event xmlID="1"><eventIdentifier><eventIdentifierType>INGEST
ID</eventIdentifierType><eventIdentifierValue>ing1234</eventIdentifierVa
lue></eventIdentifier><eventType>Remote Stream
Download</eventType><eventDateTime>2008-03-12T14:45:07.711Z</eventDateTi
me><eventDetail>Download a remote (http)
stream</eventDetail><linkingAgentIdentifier><linkingAgentIdentifierType>
Staff</linkingAgentIdentifierType><linkingAgentIdentifierValue>DIGITOOL<
/linkingAgentIdentifierValue></linkingAgentIdentifier></event></events><
/xb:history></value>
			</md>
		</mds>
		</xb:digital_entity>
</metadata>
</record>

>-----Original Message-----
>From: Martin Honnen [mailto:Martin.Honnen@xxxxxx]
>Sent: Tuesday, March 18, 2008 4:37 PM
>To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
>Subject: Re: [xsl] Looping through multiple elements
>
>Jones Mark Mr (ITCS) wrote:
>
>> I tried this;
>>
>> <xsl:for-each select="//dc:creatorid | //dc:creator1id |
>> //dc:creator2id
>> | //dc:creator3id">
>>     <component group="authors_logins" name="value">
>>     <xsl:value-of select="."/><xsl:if test="position() != last()">,
>> </xsl:if>
>>     </component>
>> </xsl:for-each>
>>
>> And the output was just this.
>> <component name="value" group="authors_logins">n030, </component>
>>
>> The metadata has values for dc:creatorid and dc:creator1id so there
>> should be a value after the comma.
>
>Show us the relevant part of the XML input then we can say more.
>
>--
>
>	Martin Honnen
>	http://JavaScript.FAQTs.com/

Current Thread