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

RE: alternative for modes

Subject: RE: alternative for modes
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Fri, 13 Feb 2004 00:40:08 -0800 (PST)
les modes en xsl

I do not understand what really is the problem. I am inclined to believe
that if it is that difficult to describe this problem, then most probably
you do not have a problem at all?

Or could you, please, provide a really concise and compact example that
illustrates the problem well?

This is a very frequent situation on this list. There are a lot of very
knowledgeable people, who can help and are willing to help.

When this help is not given, it is mostly due to the fact that the OP
couldn't express the problem well so that it would be understood

Most people hate guessing and even Jeni is sometimes clueless... :o)

Now, my guess is that you need to be passed as parameter a list of actions
(templates) to be performed. This is exactly what FXSL empowers you to do
with ease.

Waiting for a well-defined problem.


Dimitre Novatchev
FXSL developer, 

http://fxsl.sourceforge.net/ -- the home of FXSL
Resume: http://fxsl.sf.net/DNovatchev/Resume/Res.html

----------- Peter Billen wrote:
 RE:  alternative for modes | RE:  alternative for modes  
Oki I think it's time for an example :) Imagine:

		<owner> ...</owner>
		<owner> ...</owner>

Now imagine you want to print out all the cars of the streetrace: first
in red, then in blue, sorted by the owner of the car(in my example of
course, everything is a bit more complicated, especially the sorting
The best I came up with, is the following:

<xsl:template match="streetrace> 
	<!-- print cars in blue !--> 
	<xsl:call-template name="giveCarsSorted"> 
		<xsl:with-param name="mode" select="'blue'"/> 
	<!-- in red !--> 
	<xsl:call-template name="giveCarsSorted"> 
		<xsl:with-param name="mode" select="'red'"/> 

<xsl:template name="giveCarsSorted"> 
	<xsl:param name="mode"/> 

	<xsl:apply-templates>  // this will go to each <car>-element
		<xsl:sort select="car/owner"/>  // sort on <owner> in <car>
		<xsl:with-param name="mode" select="$mode"/>  // propagate

<xsl:template match="car"> 
	<xsl:param name="mode"/> 

	<xsl:if test="$mode = 'blue'"> 
		<font color="blue"> <xsl:value-of select="."/></font><br/>
	<xsl:if test="$mode = 'red'"> 
		<font color="red"> <xsl:value-of select="."/></font><br/>

I hope I didn't make any big mistakes, since I haven't tested it myself.

In my opinion the problem is: I need the same sorting more than once, so
it's a good idea to put it in a separate template (the sorting in my code
a bit more complicated). However, all the situations where I need the
sorting, DO NOT depend on any specific value(s) of the <car> -element or
or more of his children. So I THINK creating 'conditional templates' won't
help since there is no condition, which can be deduced from the
tree-structure, at all.

Thanks for your time,



Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread


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.
First Name
Last Name
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.