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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] matching namespace declar, Michael Kay | Thread | [xsl] How to use arrays in XSLT?, Ganesh Prasad .M |
RE: [xsl] matching namespace declar, Michael Kay | Date | Re: [xsl] limit number of row retur, Tham Tinh |
Month |