xsl-list
[Top] [All Lists]

grouping help (...probably)

2004-09-28 10:36:16
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[(_at_)lang=$selectedLanguage]">
                                <xsl:apply-templates 
select="bar[(_at_)xml:lang=$selectedLanguage]"/>
                        </xsl:when>
                        <xsl:otherwise>
                                <xsl:apply-templates 
select="bar[(_at_)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


<Prev in Thread] Current Thread [Next in Thread>
  • grouping help (...probably), Jan Limpens <=