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

Re: [design question]

Subject: Re: [design question]
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Wed, 5 Feb 2003 14:29:40 +0000
tennison design
Hi,

> I have a servlet based application where the servlet recieves xml
> from another application and then uses xalan to transform that xml
> to html using xsl on the server side.
>
> Now all that goes through to the browser is html so every
> transaction using the mvc pattern has a stylesheet associated with
> it. The problem is that now my stylesheets are too huge. One of
> them for example has 1653 lines, which is difficult to maintain,
> even though templated and also I am not sure what it does for the
> loading time of each stylesheet before transformation. Right now I
> dont see any problem but i was wondering whether I could improve
> this design.

If you're finding the stylesheets hard to maintain, then I think that
splitting them up is a good idea. This is particularly true if many of
your stylesheets share the same code, because it means that they can
share the same stylesheet modules and therefore you can make any
changes centrally rather than in every single stylesheet.

I'm not sure whether it will help you speed-wise; it probably depends
on how the caching works with your server-side environment. I think
that changes to the code are more likely to have an effect on speed
than splitting up the stylesheet is.

> Could I use import/include to put all the javascript in a separate
> .js file and include it when the stylesheet loads. Would this slow
> down or fasten the process.

As far as the XSLT is concerned, the Javascript is just text (unless
you're defining your own functions using <xalan:script>?). I think
that it would be a good idea to put the Javascript that you use in
your HTML pages in a separate .js file and then refer to it rather
than having it embedded in the HTML page, though. It helps maintenance
and it means that the browser can cache the .js file and reuse it
rather than loading the Javascript each time a page is loaded.

> Could I do the same for templates in the stylesheets, for example,
> each stylesheet has a status bar, I could put that in a status.xsl
> and include/import on it later.

Yes, that would be a good idea.

> Notice that I use import/include because I dont know what the
> difference is. Can someone please tell me which is faster.

I don't think that there's any difference in terms of speed, it's more
about whether you can override the stuff in the imported/included
stylesheet or not (you can when it's imported, can't when it's
included). They give very different behaviour, so which is right will
depend on what you're doing. In general, though, I'd import rather
than include because then you can override things in the base
stylesheet,

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


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


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.