xsl:for-each - How to format list?



I am new at this so please forgive me if I am being ignorant. This is a sample of my XML data.



<record ID="ART5843">
<title>This is a sample record</title>
<edition></edition>
<persauthorfull>Lykins, Amy D.</persauthorfull>
<persauthorfull>Cantor, James M.</persauthorfull>
<persauthorfull>Blanchard, Ray</persauthorfull>
<keywords>Generic</keywords>
<keywords>Criminal offences</keywords>
<keywords>Civil offences</keywords>
<keywords>Men</keywords>
<keywords>Psychology</keywords>
<keywords>Research</keywords>
<subjects></subjects>
</record>


I need the <persauthorfull> to rename to <PA> and then to output on a single line separated by semi-colon, such...



<PA>Lykins, Amy D.; Cantor, James M.; Blanchard, Ray</PA>


I am using XSL for-each to extract the names, but I have no idea of how to format them.



<xsl:for-each select="a:persauthorfull">
<PA>
<xsl:attribute name="type">
<xsl:value-of select="."/>
</xsl:attribute>
</PA>
</xsl:for-each>


From what I am surmising this is a single iteration over the author - is there another way?


No comments:

Post a Comment