[xsl] Concatenation of the same elements

Subject: [xsl] Concatenation of the same elements
From: "Jacqueline Radebaugh" <jrad@xxxxxxx>
Date: Mon, 21 Aug 2006 10:13:30 -0400
Hello:

I've gone through all of my books and looked at XSLT websites and list
archives and cannot find how to do this. I would appreciate any assistance
that you could provide to me.

My XML code is:

<indicator>
<label>ind2</label>
<name>Level of content designation</name>
<status date="1993">NEW</status>
<format>BK</format>
<format>AM</format>
<format>CF</format>
<format>MP</format>
<format>MU</format>
<format>VM</format>
<level>standard</level>
<uri>info:marc.bib/505/hist/ind2</uri>
<description>
<p>Prior to 1993, the value blank (#) in Indicator 2 can be interpreted as
Basic. </p>
</description>
</indicator>

I want the output to look like this:

Indicator 2 - Level of content designation (BK AM CF MP MU VM) [NEW, 1993]
Prior to 1993, the value blank (#) in Indicator 2 can be interpreted as
Basic.

I have everything working except the <format> transformation. The XML tagging
is:

<format>BK</format>
<format>AM</format>
<format>CF</format>
<format>MP</format>
<format>MU</format>
<format>VM</format>

and I want the output to look like (BK AM CF MP MU VM).

My current XSLT code is:

<xsl:template match="format[parent::indicator and ancestor::history]">
<xsl:text> (</xsl:text>
<xsl:apply-templates/>
<xsl:text>) </xsl:text>
</xsl:template>

This XSLT code, however, generates the following output:

(BK) (AM) (CF) (MP) (MU) (VM)

I've tried using concat, variables, testing position() and various other XSLT
commands with no luck. Do you have any ideas on how to obtain the output:

(BK AM CF MP MU VM)


Thank you very much for your help!


Best wishes,







Jackie Radebaugh

Library of Congress
Network Development & MARC Standards Office
Washington, DC
USA
Phone:  +1-202-707-1153
FAX:  +1-202-707-0115
E-Mail:  jrad@xxxxxxx

Current Thread