xsl-list
[Top] [All Lists]

RE: Moded Templates

2003-01-06 14:22:20
Simon:

I have 1 dtd/xml which represents a complex object(a collection which can
contain a collection, etc). Initially, I started with 14 style sheets and
saw redundant code...being fairly new to XSL this was the safe way to go but
I'd like to do it better. From the main (initial) html screen the user has
the option to perform 6 functions to the main collection. So, depending on
the button selected a Servlet builds the xml file from database values (if
available) and then the transformation result is sent to the browser with
the appropriate screen.

For example, the initial web app page merely consist of a list of available
objects that the user can perform the aforementioned functions. The object
composition (xml) is as follows:

<MaintFunction>
 <Element1/>
 <Element2/>
 <Collection1>
   <Collection1ChildCollection>
     <AnotherElement>
       <AnotherCollection>
          <..Element>
            <..Collection>
               ...
            </..Collection>
          </..Element>
       </AnotherCollection>
     </AnotherElement>
   </Collection1ChildCollection>
 </Collection1>
</MaintFunction>
  
Some of these elements are optional or will be empty but the object
structure is consistent (if that makes any sense) and some of the elements
will always need to be transformed into html. I was hoping that "mode" was
my ticket. Jeni replied with a solution- I'll have to tinker with it.

Later,
-Will

-----Original Message-----
From: S Woodside [mailto:sbwoodside(_at_)yahoo(_dot_)com]
Sent: Monday, January 06, 2003 2:41 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] Moded Templates



On Monday, January 6, 2003, at 01:44  PM, Lopez, William wrote:

<xsl:template match="A" mode="(A|B|C)">
...
</xsl:template>

You could have three templates that match="A" with A,B,C as the modes, 
and use call-template to call the same template rule in each one.

Why do you have so many different modes? It might be better to find a 
way to collapse the three different modes into one, for example, delay 
the conditional decision making until somewhere further down the tree.

simon

---
www.simonwoodside.com


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

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



<Prev in Thread] Current Thread [Next in Thread>