Javascript, XSLT, or ?

Firic

Junior Member
Jan 25, 2006
7
0
0
I'm working on a little project right now to help me improve my HTML/XML/Javascript etc skills. What I'm trying to do is to display a database, and let the user sort and manipulate it dynamically.

I already have the database in XML format, but have been trying to work out the best way to display it. I started out with javascript, and worked out a nice display but am now having problems trying to implement a sort function. I started looking into XSLT, and was impressed by the built in sort function, but it seems near impossible to be able to change the search criteria dynamically.

My question is, am I even using the right tools? I'm using my work computer, which does not allow me to install any software (at least software that makes a registry entry) which is why I'm using XML and Javascript. Do I have another option I'm not aware of?

To clarify, I have 600 records that each contain several elements. I want to be able to specify the number of records, which elements to display, and how they should be sorted. Can anyone give me a nudge in the right direction?
 

drebo

Diamond Member
Feb 24, 2006
7,034
1
81
XML is not meant to be a data storage mechanism. Rather, XML is used for easy, structured data transmission. I.E. company X has a large database that they would like to allow company Y to query some of the data (ERP is one application of this). Instead of giving them access to the database directly (security issue), they're given a service which they can use that outputs the data in an XML format (could be a proprietary format, but this was the intended purpose of XML).

So, in your example of storing your 600 records in XML and using Javascript to query/sort it...that's not something you'd really ever do. The querying and sorting will typically happen server-side.

If you're serious about database programming, you'll need a server-side language and a DBMS. PHP and MySQL is a popular one.
 

Firic

Junior Member
Jan 25, 2006
7
0
0
Thanks for the reply. I am taking this approach as a possible alternative to an Excel spreadsheet or Access Database. Security isn't a big concern, this would only be used internally. At one point we were using an Excel spreadsheet on a shared drive, but we run into problems where only one user can access it at a time. We have the information in an Access database as well, but it is slow and very also has problems handling multiple users at once.

I had the idea to create an XML document from this data and use some kind of web interface in order to allow multiple users to view/add to the data at once time, and because I can easily update it this way. It may be that this won't wind up being more efficient than what we have currently, but I'm doing it in my spare time and I thought it would be a good excuse to learn XML, javascript, etc.
 

QuixoticOne

Golden Member
Nov 4, 2005
1,855
0
0
You can programatically generate XSLT transforms to be applied, even in Javascript if you feel like being masochistic.

There are higher level standards like XQUERY that are designed to generate reports based on queries via XML oriented processes.
http://www.gnu.org/software/qexo/
http://www.gnu.org/software/qexo/XQuery-Intro.html

Also there's a lot of other stuff, XFORMS, XML data binding to C++ or JAVA or whatever classes, XML user interface systems, et. al.

If you're trying to logically organize your data, you need a good schema / model.

If you're trying to present the data formatted in a certain way you need a UI generation system or result thereof, Forms design, report design, stylesheets, or so on.

If you're trying to access the data then you should look at XML data binding or XML query systems, XML database systems, et. al.

Sorting data is pretty much a query level function or at least a data flow or stylesheet process that occurs on the result of the query.

"Manipulate it dynamically" is ambiguous. If you mean manipulate the VIEW of the data, the UI, the form / report of of then that's at the level of programatically generating a UI / Stylesheet / form et. al. and has nothing much to do with the data or how it is stored, it is strictly a presentation formatting aspect.

If you mean manipulate the data dynamically like get, set, delete, that's basically an XML database activity.

If you mean manipulate the data like entering in a formula or subroutine or SQL / XQUERY and calculating it over the data set like EXCEL, that's just dynamically generating / parsing / executing things in some custom higher level expression parser / query definition language / whatever.

Check these out and get an idea of what they do. Keep in mind the MVC (model, view, controller) type design and the distinctions of data versus formatting versus schema et. al.

http://en.wikipedia.org/wiki/GladeXML
http://en.wikipedia.org/wiki/Xforms

http://en.wikipedia.org/wiki/ZK_Framework
http://www.mozilla.org/projects/xul/
http://en.wikipedia.org/wiki/XBL
http://en.wikipedia.org/wiki/XUL
http://en.wikipedia.org/wiki/OpenLaszlo


http://en.wikipedia.org/wiki/XML_Data_Binding
http://www.gnu.org/software/qexo/
http://www.rpbourret.com/xml/XMLDataBinding.htm
http://www.castor.org/
http://dingo.sourceforge.net/features.shtml
http://projects.apache.org/indexes/quick.html
http://cayenne.apache.org/
http://jakarta.apache.org/ecs/
http://xmlgraphics.apache.org/fop
http://forrest.apache.org/
http://tapestry.apache.org/
http://struts.apache.org/
http://db.apache.org/torque/
http://turbine.apache.org/
http://velocity.apache.org/
http://xml.apache.org/xindice/

http://commons.apache.org/jxpath/
http://www.w3.org/TR/xpath