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

Re: flatten tree

Subject: Re: flatten tree
From: Jan Limpens <jan.limpens@xxxxxxxxx>
Date: Mon, 20 Sep 2004 20:20:46 -0300
flatten tree
ok, I think I got it right now, more or less

I now have 2 xslt files, one imports the other and so on... sorry for
the lengthy fuzz, earlier.

but still I am not seeing through entirely and it does'nt work as
expected, still.

*[@lang = $selectedLanguage or (not(@lang) and $defaultLanguage =
$selectedLanguage)]

selects every element which lang attribute is set to the
selectedLanguage or every element which has no lang attribute whenever
the selectedLanguage matches the defaultLanguage. right?

this is why, i get the right result whenever
selectedLanguage=defaultLanguage. When this is not the case I get
nothing. hmm. strange.

so i tried
*[@lang = $selectedLanguage or (not(@lang) or @lang = $defaultLanguage)]

but this is the same as I had before, without the xsl chain
transformation. unfortunately (in this case) the transformer does not
stop if the first condition is met and so i get the element in the
selected language as well the element in the default language.

so i tried
	<xsl:template match="*">
		<xsl:choose>
			<xsl:when test="(@lang = $selectedLanguage) or (not(@lang))">
				<xsl:apply-imports/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:if test="@lang = $defaultLanguage">
					<xsl:apply-imports/>
				</xsl:if>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
which is not very beautiful, but still, out of reasons i do not
understand, it seems that the otherwise clause gets executed, even
when the when-clause returns true.

so I am really stuck here. any help is gladly appreciated!

--
cheers
jan

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.