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

fallback parameter

Subject: fallback parameter
From: Jan Limpens <jan.limpens@xxxxxxxxx>
Date: Wed, 22 Sep 2004 22:59:49 -0300
xsl lc
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

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.