How to create a colaspible table using xml and xslt

I have an xml structure that contains data from a database. It has multiple rows and multiple columns.

I like to figure out an xsl that would take the data from the xml and create a html table component show the data from the xml.

I would also like to have the table use +/- to expand/colaspe sections based on differnent values in fields as well as total some columns.

Is this something doable with xslt?
robert_jenkinAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Geert BormansConnect With a Mentor Information ArchitectCommented:
All of this is pretty much in line with what I wrote before

use javascript (with sarissa library) to start the XSLT and based on user events,
start the same XSLT with different parameters to render the table in a different way
This seems like a pretty straightforward usecase for this approach
0
 
Geert BormansInformation ArchitectCommented:
well, XSLT can be used to build any html table based on values and structures in the data table.
but in order to do the collapse and expand, potentially sorting and all that, you will need something that controls the rendering of the table.

Most common way to achieve this task is to use an Ajax type approach
Use javascript in an HTML page to launch the XSLT that returns an HTML table with controls (buttons or whatever)
Make the click events refresh the table by running the XSLT with different parameters rendering a different type of table

This is pretty easy to set up if you would use a library such as Sarissa,
which would make running the XSLT in JavaScript browser independent

I have done a large amount of similar projects using XSLT and Sarissa to give full control on data in an HTML page
If that is what you want, you need to give us some more detaisl so we could come up with an example

Answer to your question: Is this doable using XSLT?
Yes
0
 
Geert BormansInformation ArchitectCommented:
You can't simply delete this question.
You have asked a question, I have given a complete answer
please accept the answer, or give more detail as requested
0
What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

 
robert_jenkinAuthor Commented:
All data to/from webpage is done by means of webservices. Aweb service is call and xml is returned. The tools be used are pure java (web service) and java script. The xml returned is basically data from a sql datas (the system is a report writer) the user chooses the columns to be included, the columns to order by, group by and to tally on.  

I am trying to find a way to take the xml and present it on the web page where by sections of the data (controled by group by columns) can be colapsed/expanded and to also show the tallys. The basic structure is a control-break report. the xml is already provided in data order based on use section.
0
 
robert_jenkinAuthor Commented:
Was of little help was expect some type of example. but I guess its the way I asked the question
0
 
Geert BormansInformation ArchitectCommented:
yep, you could have asked for an example.

question was "Is this something doable with xslt?"
Not directly a request for examples, I just told you how, noone stops you from given more detail.
Note that I made the offer in my first response
"If that is what you want, you need to give us some more details so we could come up with an example"
0
 
robert_jenkinAuthor Commented:
I have reviewed your recommended library and it does not address the need, helps... Like I said when I closed this, it was the way I asked the question... I need a javascript solution that can do the following ;

sample xml (note actual will include alot more columns).


 <data>
 <row>
  <reference_no>00700010000208NA</reference_no>
  <balance>1500</balance>
  </row>
   <row>
  <reference_no>00700010000208NA</reference_no>
  <balance>1500</balance>
  </row>
 <row>
  <reference_no>00700010000208NA</reference_no>
  <balance>1500</balance>
  </row>
 <row>
  <reference_no>00700010000208</reference_no>
  <balance>1500</balance>
  </row>
 <row>
  <reference_no>00700010000208</reference_no>
  <balance>1500</balance>
  </row>
 <row>
  <reference_no>00700010000208</reference_no>
  <balance>1500</balance>
  </row>
 <row>
  <reference_no>00700010000208</reference_no>
  <balance>1500</balance>
  </row>
</data>

 I currently return the xml to the webbrowser via webservice. In the browser I like to display the data in some type of table form where sections can be colapsed and expanded and all so so totals. using the sample data below I would like to see something like this

+/-   Reference                                       Balance
-     00700010000208NA                       4,500.00
      00700010000208NA                       1,500.00
      00700010000208NA                       1,500.00
      00700010000208NA                       1,500.00
+     00700010000208                           6,000.00

The columns that control the grouping and totals are not always the same.

I like to do this with xsl and javascript. I assume I would have to write the xsl on the fly based on the columns being returned in xml. it is my understanding that xsl can handle the task of totals and the generating of the table. if I am wrong please let me know and I will look for a different solution.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.