[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: fallback 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|