Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 17th, 2006, 03:55 AM
Authorized User
Join Date: Sep 2006
Location: Cologne, , Germany.
Posts: 92
Thanks: 0
Thanked 0 Times in 0 Posts
Default Lot's of 'when' clauses ...

Hallo All,

This is a bit of a design question and so I hope that someone can give me a second opinion and maybe some tips?

I have an XSL stylesheet with a range of options that the user can choose (presented in list-boxes). For each selection, a different set of processing is triggered. The parameters (for the various displays) processed by a little block javascript: Basically this just sets the new parameters and reposts the page.

There is a lot of grouping/summing so the first action is to call (one of a number of) the following ...

<xsl:when test="$plevel='plt'">
<xsl:apply-templates select="rep_base[generate-id()=generate-id(key('kteam', team)]" mode="dteam">
[? Possible match location ?]
[other when statements]

This in turn, then calls the following:

<xsl:template match="rep_base" mode="dteam">
<td><xsl:value-of select="team" />
<td ALIGN="RIGHT"><xsl:value-of select="sum(key('kteam', team)[plant_code=$pfiltfld]/GOODS_CNT)" />

All this works fine but now it is becoming extremely complicated with a whole stack of 'when' statements calling various templates presenting various views of the data.

I then thought I would try putting the 'template' inside the 'apply-templates select' clause but the syntax was not accepted.

So my question here is: How can I best tidy up all these 'when' clauses and make clear blocks of functionality which enable easier maintenance. i.e. it is very difficult to jump between the apply-template clause and the actual template display.

Or maybe I should separate things and use 'include' statements to add the other styles? But I have considered this and am not sure how I would get the selection lists, the javascript and the 'included' templates to interact (i.e. it might be more confusing).

Anyway, any tips on how to keep 'mushrooming' code under control would be a great help.


Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

All times are GMT -4. The time now is 07:06 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.