Subject: [xsl] fallback parameter From: Jan Limpens <jan.limpens@xxxxxxxxx> Date: Wed, 22 Sep 2004 22:59:49 -0300 |
Hi folks, I am still trying to bring this to work, but could not come up with anything useful so far... (there is another thread for this problem already, but it seems quite buried and forgotten, I hope very much you don't mind for bringing this up again) In my xml I have areas marked with lang='somelanguage'. In my xslt I defined a parameter selectedLanguage (can be changed by user input) and a parameter defaultLanguage, that is used, when no content in the selected Language is available. The problem is, that I cannot manage to bring this to work. As soon as the selected language differs from the default one and there is an entry in the selected language, I see both entries. If the selected language has no corresponding area, it works as expected. In the example the results are defLang selLang Result en en ok en de not as expected en es ok I don't understand why this is so... the xml looks like this: <BlogInfos> <BlogInfo lang="pt"> <Title>Ilustragues e outros trabalhos graficos</Title> <Description>Uma lista de meus trabalhos de ilustragco</Description> </BlogInfo> <BlogInfo lang="de"> <Title>Illustrationen und andere grafische Arbeiten</Title> <Description>Eine chronologische Auflistung aller Arbeiten, die ich in den letzten Jahren als Illustrator und Graphic Designer realisiert habe.</Description> </BlogInfo> <BlogInfo lang="en"> <Title>Illustrations and other visual ventures</Title> <Description>Here you will find a wild mix of projects, jobs, ideas, rants and everything that comes to my mind in this category.</Description> </BlogInfo> </BlogInfos> and the xslt like this: <xsl:param name="selectedLanguage" select="'de'"/> <xsl:param name="defaultLanguage" select="'en'"/> <xsl:template match="lc:BlogInfo"> <xsl:if test="@lang=$selectedLanguage or (not(following-sibling[@lang=$selectedLanguage]) and not(preceding-sibling[@lang=$selectedLanguage]) and @lang=$defaultLanguage)"> <div id="IntroDiv"> <h1> <xsl:value-of select="lc:Title"/> </h1> <p> <xsl:value-of select="lc:Description"/> </p> </div> </xsl:if> </xsl:template> please help -- Jan http://www.limpens.com
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] To Split, Pick/Select, Ob, SANWAL, ABHISHEK (HP | Thread | Re: [xsl] fallback parameter, Anton Triest |
RE: [xsl] To Split, Pick/Select, Ob, SANWAL, ABHISHEK (HP | Date | [xsl] <xsl:call-template> and form , Jen Jiang |
Month |