[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

How to return a result for just the first group

Subject: How to return a result for just the first group
From: Kevin Rodgers <kevin.rodgers@xxxxxxx>
Date: Mon, 24 Jan 2005 17:20:06 -0700
iso 6802
I've got XML like this:

<title_list>
<title type="TITLE" language="de">Gummi- und Kunststoffschlaeuche und -schlauchleitungen mit Drahteinlage; Hydraulik-Impulspruefung mit wechselnder Biegung (ISO 6802:1991)</title>
<title type="SUBTITLE" language="de">Deutsche Fassung EN 26802:1993</title>
<title type="TITLE" language="en">Rubber and plastics hose and hose assemblies with wire reinforcements; hydraulic impulse test with flexing (ISO 6802:1991)</title></title>
<title type="SUBTITLE" language="en">german version EN 26802:1993</title>
</title_list>

What I want to do is generate text by concatenating the title and
subtitle of the first language:

Gummi- und Kunststoffschlaeuche und -schlauchleitungen mit Drahteinlage; Hydraulik-Impulspruefung mit wechselnder Biegung (ISO 6802:1991)
Deutsche Fassung EN 26802:1993

That is easy enough to do when the title and subtitle pairs are already
grouped by language as above:

<xsl:value-of select="concat(title_list/title[@type='TITLE'][1],
                             $separator,
                             title_list/title[@type='SUBTITLE'][1])"/>

But if the order were to change, that wouldn't work:

<title_list>
<title type="TITLE" language="de">Gummi- und Kunststoffschlaeuche und -schlauchleitungen mit Drahteinlage; Hydraulik-Impulspruefung mit wechselnder Biegung (ISO 6802:1991)</title>
<title type="TITLE" language="en">Rubber and plastics hose and hose assemblies with wire reinforcements; hydraulic impulse test with flexing (ISO 6802:1991)</title></title>
<title type="SUBTITLE" language="en">german version EN 26802:1993</title>
</title_list>
<title type="SUBTITLE" language="de">Deutsche Fassung EN 26802:1993</title>

To get that same result, I think I need to use for-each-group:

<xsl:for-each-group select="mb3e:title_list/mb3e:title" group-by="@language">
  <xsl:value-of select="concat(current-group()[@type='TITLE']",
                               $separator,
                               current-group()[@type='EXT']")/>
</xsl:for-each-group>

But I don't know how to restrict it so that value-of is only applied to
the first group...

Thanks,
-- 
Kevin

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.