Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Should XSLT reside in Dynamic Web Project or Database?

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

My boss asked me a really good question yesterday, "Is XSLT data or code?".

We have a J2EE application that retrieves XML data from a database which is then sent on to customers.
Before being sent onwards it may have a stylesheet applied to it to transform the data.

There are less than 10 stylesheets and there will not be more (so no need to future-proof application).

Given these circumstances, should those stylesheets be retrieved from the database (are they data) or should they reside in the Dynamic Web project (are they code).

Either solution will work but can anyone guide me as to a preferred Design Solution?

Thanks in Advance
 
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd say they're definitely code. Look at it this way - if you make a change to an XSLT file and get it wrong, you've broken the application. They've got the same status as any other application source code. I think the purpose of the file is more important than the fact it happens to be in the form of XML.
 
Marshal
Posts: 24594
55
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would be agnostic as to whether an XSLT file was data or code -- I might even be convinced to call it configuration. But as soon as "data" means it's going in a database, then no. It isn't data.
 
Bartender
Posts: 1952
7
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd say store the XSLT on the file system. It just as easily accessible and I'm guessing (guessing mind you) that it may also be faster, also you may not want to waste the tablespace. That is unless you've got a complex scenario going on where you also store meta-data about the XSLT (e.g. versioning) and are updating both frequently. In that case, if you store meta-data in the DB and the XSLT as files on the file system, and updates are part of a larger overall transaction that is prone to rollback (due to optimistic locking for instance) keeping the filesystem and DB in synch could get complicated.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!