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

Re: fallback parameter

Subject: Re: fallback parameter
From: Jan Limpens <jan.limpens@xxxxxxxxx>
Date: Thu, 23 Sep 2004 10:09:32 -0300
xsl a parameter
There's in light! Ok, I must admit, I feel a bit ashamed not to have
seen this. It seems to be a typical beginner's mistake to try every
ugly hack to make a thing worked as  planned and to overlook all the
other simple options at the same time!

Thanks a lot guys!

--jan


On Wed, 22 Sep 2004 19:37:17 -0700, James A. Robinson
<jimr@xxxxxxxxxxxxxxxxxxxxx> wrote:
> 
> Hi,
> 
> I'm sorry that I can't directly answer your question but I don't
> understand the logic you are trying to lay out in your <xsl:if> test.
> I understand what you want to do, I just don't see how you can accomplish
> what you want. The reason is that, as far as I knew, when you have a
> template matching BlogInfo, every single BlogInfo is going to be tested
> and so as long as your default language exists it will always be true.
> Forgive me if that's a stupid statement on my part. :(
> 
> I was hoping the stylesheet below might be of help?  It shows a simpler
> logic flow, where at the top level, the BlogInfos level, you decide which
> BlogInfo to display.  I don't know what constraints you are working under
> w/re to the template matches, but I would hope you could make use of this.
> 
> <?xml version="1.0" encoding="UTF-8" ?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
> 
>   <xsl:param name="selectedLanguage" select="'de'"/>
>   <xsl:param name="defaultLanguage" select="'en'"/>
> 
>   <xsl:template match="BlogInfos">
>     <xsl:choose>
>       <xsl:when test="./BlogInfo[@lang=$selectedLanguage]">
>         <xsl:apply-templates select="BlogInfo[@lang=$selectedLanguage]"/>
>       </xsl:when>
>       <xsl:otherwise>
>         <xsl:apply-templates select="BlogInfo[@lang=$defaultLanguage]"/>
>       </xsl:otherwise>
>     </xsl:choose>
>   </xsl:template>
> 
>   <xsl:template match="BlogInfo">
>     <div id="IntroDiv">
>       <h1>
>         <xsl:value-of select="Title"/>
>       </h1>
>       <p>
>         <xsl:value-of select="Description"/>
>       </p>
>     </div>
>   </xsl:template>
> 
> </xsl:stylesheet>
> 
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> James A. Robinson                       jim.robinson@xxxxxxxxxxxx
> Stanford University HighWire Press      http://highwire.stanford.edu/
> 650-723-7294 (W) 650-725-9335 (F)
> 



-- 
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.