[xsl] grouping help (...probably)

Subject: [xsl] grouping help (...probably)
From: Jan Limpens <jan.limpens@xxxxxxxxx>
Date: Tue, 28 Sep 2004 14:36:16 -0300
hi people,

i've got (type of) this xml:

<root>

<foo>
<bar xml:lang="de">1de</bar>
</foo>

<foo>
<bar xml:lang="en">2en</bar>
<bar xml:lang="de">2de</bar>
</foo>

<foo>
<bar xml:lang="en">3en</bar>
</foo>

<foo>
<bar xml:lang="en">4en</bar>
<bar xml:lang="de">4de</bar>
</foo>

</root>

and an xsl that allows to choose a language, and, if there is no item
in the selected language, falls back to the default language, which
usually is English.

	<xsl:template match="foo">
		<xsl:choose>
			<xsl:when test="bar[@lang=$selectedLanguage]">
				<xsl:apply-templates select="bar[@xml:lang=$selectedLanguage]"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:apply-templates select="bar[@xml:lang=$defaultLanguage]"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

but now i need only the first 3 (a param) entries, so that when de is
the selected language i get:
1de - 2de - 3 en
an when it's en
2en - 3en - 4en

and I don't know how to do this. I somehow get the feeling that
grouping might be involved, but have no clue how to really make it
work...

anyone can help me?

-- 
Jan
http://www.limpens.com

Current Thread