0

I have a table with many columns, can I convert this table to represent the same information but with the column headers placed at rows. Example try to convert this table:

{| class="wikitable"
! scope="col"| Benchmark
! scope="col"| Total number of transactions
! scope="col"| Device data reads (DMA)
! scope="col"| Device data writes (DMA)
! scope="col"| Uncacheable data reads         
! scope="col"| Uncacheable data writes        
! scope="col"| Uncacheable instruction fetches
! scope="col"| Data read transactions         
! scope="col"| Data read misses               
! scope="col"| Data read hit-ratio             
! scope="col"| Instruction fetch transactions 
! scope="col"| Instruction fetch misses       
! scope="col"| Instruction fetch hit-ratio     
! scope="col"| Data write transactions        
! scope="col"| Data write misses              
! scope="col"| Data write hit-ratio            
! scope="col"| Copy-back transactions
|-
! scope="row"| Vortex
| 572369
| 0
| 0
| 0
| 0
| 0
| 193418
| 43473
| 77.52%
| 261195
| 103199
| 60.49%
| 117756
| 83646
| 28.97%
| 0
|-
! scope="row"| Equake
|482932
|0
|0
|0
|0
|0
|128014
|16909
|86.79%
|281793
|58486
|79.25%
|73125
|14086
|80.74%
|0
|-
! scope="row"| Parser
|571505
|0
|0
|0
|0
|0
|224470
|26972
|87.98%
|224082
|14404
|93.57%
|122953
|50771
|58.71%
|0
|}

Into something like:

{| class="wikitable"
! scope="col"| Benchmark
! scope="col"| Vortex
! scope="col"| Equake
! scope="col"| Parser
|-
.
.
.

Is it possible that a template could do this?

Joelmob
  • 1,076
  • 2
  • 10
  • 22

2 Answers2

2

Ar you looking to transpose the whole table? There is no built in function for that in MediaWiki, and I doubt creating a template for it would be worth he trouble (unless you are using Lua). If this is a need that is only occuring once in a while I would simply copy/paste the table into LibreOffice Calc/Excel/etc and transpose is there, and then recreate the table.

If you need to do this automatically on a regular basis, have a look at the Scibuntu extension and Lua, and ask again if you get stuck!

If you are happy with a JavaScript solution, there are a few SO questions on that already, see e.g. Convert TD columns into TR rows

Community
  • 1
  • 1
leo
  • 8,106
  • 7
  • 48
  • 80
  • Thank you, I was looking at those also, but I was hoping there would be something to do this in mediawiki. – Joelmob Apr 26 '14 at 19:49
1

You could do a one-off using templates: Say you have one or two tables where you want to maintain both versions, transposes of each other.

I will put up an example at en.wikipedia.org/User:Rich Farmbrough/transpose

  • 1
    please add the answer here or just put some explaination than just posting a link. – anuj arora Apr 29 '14 at 04:53
  • I looked at this example but i think that looks complicated, this need a new template for every such table that can be transposed, but maybe can be improved. – Joelmob Apr 30 '14 at 03:45