Tables and Lists in xml configurations

14 views
Skip to first unread message

Samar Ayesh

unread,
Mar 12, 2013, 8:23:09 AM3/12/13
to bungeni...@googlegroups.com
Hello Ashok,

I would like to ask you if tables and lists are supported via xml configuration to be generated in xml AkomaNtoso file format?

Ashok Hariharan

unread,
Mar 12, 2013, 10:42:10 AM3/12/13
to bungeni...@googlegroups.com
On 12 March 2013 15:23, Samar Ayesh <smr....@gmail.com> wrote:
Hello Ashok,

I would like to ask you if tables

Tables there is no special xml configuration .. But you can map ODF tables directly to Akoma Ntoso tables .. since AKoma Ntoso tables are kind of like html tables ... So you would create tables like you do in openoffice (we could implement an action to add a table ..otherwise enable the toolbar in openoffice to add tables )

The only thing that needs to be added is middle-ware support for transforming tables, I can help you do this ... since its just writing xslt template mappers in the middle ware .
 
and lists are supported via xml configuration to be generated in xml AkomaNtoso file format?

Lists are a different story...but they are partially supported currently. Since we are in OpenOffice - the document natively supports lists but these are problematic to use ... since the lists are really a "visual" representation i.e. a numbered list in Openoffice has only "virtual" numbering (i.e. the number is not stored in the document) ... in AN you want lists with real numbering where the number is stored in the file. So for lists you should use explicit markup (see the bills implementation in development_configs). I think a combination of openoffice lists with marked up numbering will also work e.g. you create a standard bullet list in openoffice and then markup the numbers manually.

 

--
You received this message because you are subscribed to the Google Groups "bungeni-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bungeni-edito...@googlegroups.com.
To post to this group, send email to bungeni...@googlegroups.com.
Visit this group at http://groups.google.com/group/bungeni-editor?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Samar Ayesh

unread,
Mar 13, 2013, 5:00:22 AM3/13/13
to bungeni...@googlegroups.com
The only thing that needs to be added is middle-ware support for transforming tables, I can help you do this ... since its just writing xslt template mappers in the middle ware 

aha, this is what I was thinking of .. but could you plz implement an example for it ?

Samar Ayesh

unread,
Mar 13, 2013, 7:16:24 AM3/13/13
to bungeni...@googlegroups.com
Or is there a documentation for adding mappers in the middle ware??

Samar Ayesh

unread,
Mar 13, 2013, 8:27:00 AM3/13/13
to bungeni...@googlegroups.com
Hello Ashok,

I Just added an Action for Table sectionType, but it seems that there is something missing to allow it to appear into generated xml !!

Ashok Hariharan

unread,
Mar 14, 2013, 4:26:43 AM3/14/13
to bungeni...@googlegroups.com
Hi Samar --

Let me document the steps of how to implement table  -

Just some points to understand the concept :

1) sectionTypes in the editor are containers (think of them like <div> elements in html ) . They are place holders to embed metadata and content.

2) Tables are pure content - so you would put a table *inside* a sectionType (the sectionType is NOT a table).

3) In openoffice there is native support for tables, so we dont need to invent our own table - we just use the Openoffice table.

The implementation would be in 2 parts - you need to implement the table markup and then you need to implement the translation of the table markup into Akoma Ntoso (in the middleware)

Implementing tables markup :

4) The editor uses an action-> router architecture to take user input and translate that into markup on the document.

a ) you need to implement a router action to create a table. Just like the way we have a router action to create a section "routerCreateSection", you will need to create a router Action to create a table "routerCreateTable".  This action will call the openoffice UNO api and generate a table on the current document.

b) However, creating a table requires some human input (e.g. how many rows and columns does the table have ? ) - so the action will have to implement a dialog accept the rows and columns information from the user and then use that information to inject a table where the cursor is. e.g. the UNO api for creating a table looks something like this :
   XTextTable xTextTable = (XTextTable)((XMultiServiceFactory)TextDocument).createInstance("com.sun.star.text.TextTable");
   xTextTable.initialize(4, 2);

to create a table of 4 rows and 2 columns

c) Connect the router to a user action via the toolbar actions infrastructure ... specify the rules as to which kinds of section types support tables and you will have the markup support completed

Implementing tables akomantoso rendering :

5) This is very straightforward - you just need implement a template matcher for text:table (the openoffice table) and render it as Akoma Ntoso table in the XSLT , i think the right place to do it is perhaps in : system_configs/generator/type_meta_ident_publi_generator.xsl

Samar Ayesh

unread,
Mar 19, 2013, 7:12:58 AM3/19/13
to bungeni...@googlegroups.com


On Thursday, March 14, 2013 10:26:43 AM UTC+2, Ashok Hariharan wrote:
Hi Samar --

Let me document the steps of how to implement table  -

Just some points to understand the concept :

1) sectionTypes in the editor are containers (think of them like <div> elements in html ) . They are place holders to embed metadata and content.

2) Tables are pure content - so you would put a table *inside* a sectionType (the sectionType is NOT a table).
              Yes, just like reference link it's an inline type inside a section type .. 
 
3) In openoffice there is native support for tables, so we dont need to invent our own table - we just use the Openoffice table.

The implementation would be in 2 parts - you need to implement the table markup and then you need to implement the translation of the table markup into Akoma Ntoso (in the middleware)

Implementing tables markup :

4) The editor uses an action-> router architecture to take user input and translate that into markup on the document.

a ) you need to implement a router action to create a table. Just like the way we have a router action to create a section "routerCreateSection", you will need to create a router Action to create a table "routerCreateTable".  This action will call the openoffice UNO api and generate a table on the current document.
routerCreateSection has the method "route_TextSelectedInsert" which I don't know how to edit to obtain the code specified for tables !!
 
b) However, creating a table requires some human input (e.g. how many rows and columns does the table have ? ) - so the action will have to implement a dialog accept the rows and columns information from the user and then use that information to inject a table where the cursor is. e.g. the UNO api for creating a table looks something like this :
   XTextTable xTextTable = (XTextTable)((XMultiServiceFactory)TextDocument).createInstance("com.sun.star.text.TextTable");
   xTextTable.initialize(4, 2);

to create a table of 4 rows and 2 columns
   Yes, this is done when the user creates a new table .. but what if the table is already there through out the act text ?
        and we just want to select and mark it as table ? Does the user need to count all rows and columns there?

c) Connect the router to a user action via the toolbar actions infrastructure ... specify the rules as to which kinds of section types support tables and you will have the markup support completed
    I think this is clear ..

Implementing tables akomantoso rendering :

5) This is very straightforward - you just need implement a template matcher for text:table (the openoffice table) and render it as Akoma Ntoso table in the XSLT , i think the right place to do it is perhaps in : system_configs/generator/type_meta_ident_publi_generator.xsl
    Have I need to implement td, tr, inside table tages ??

Ashok Hariharan

unread,
Mar 19, 2013, 9:23:32 AM3/19/13
to bungeni...@googlegroups.com


On 19 March 2013 14:12, Samar Ayesh <smr....@gmail.com> wrote:



On Thursday, March 14, 2013 10:26:43 AM UTC+2, Ashok Hariharan wrote:b) However, creating a table requires some human input (e.g. how many rows and columns does the table have ? ) - so the action will have to implement a dialog accept the rows and columns information from the user and then use that information to inject a table where the cursor is. e.g. the UNO api for creating a table looks something like this :
   XTextTable xTextTable = (XTextTable)((XMultiServiceFactory)TextDocument).createInstance("com.sun.star.text.TextTable");
   xTextTable.initialize(4, 2);

to create a table of 4 rows and 2 columns
   Yes, this is done when the user creates a new table .. but what if the table is already there through out the act text ?
        and we just want to select and mark it as table ? Does the user need to count all rows and columns there?


If the table is already there on the document - then you dont need to mark it up. The middleware implementation in step(5) will automatically convert it to a Akoma Ntoso table.
 

Implementing tables akomantoso rendering :

5) This is very straightforward - you just need implement a template matcher for text:table (the openoffice table) and render it as Akoma Ntoso table in the XSLT , i think the right place to do it is perhaps in : system_configs/generator/type_meta_ident_publi_generator.xsl
    Have I need to implement td, tr, inside table tages ??

 

No not really - e.g. this is the odf table -- you just need xslt template matchers to convert it to a AN table ..

e.g. <xsl:template match="table:table-row">
    <tr>
     <xsl:apply-templates />
   <tr>
</xsl:template>


ODF Table
<table:table xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0">
  <table:table-columns>
    <table:table-column/>
    <table:table-column/>
  </table:table-columns>
  <table:table-rows>
    <table:table-row>
      <table:table-cell>
        <text:p>row one, column one</text:p>
      </table:table-cell>
      <table:table-cell>
        <text:p>row one, column two</text:p>
    </table:table-cell>
    </table:table-row>
    <table:table-row>
      <table:table-cell>
        <text:p>row two, column one</text:p>
      </table:table-cell>
      <table:table-cell>
        <text:p>row two, column two</text:p>
      </table:table-cell>
    </table:table-row>
  </table:table-rows>
</table:table>
 

Samar Ayesh

unread,
Mar 20, 2013, 4:51:44 AM3/20/13
to bungeni...@googlegroups.com
and what about editing methods for routerCreateTable.java?
Sorry, I feel that I don't know how to configure the code for table needs !!

Ashok Hariharan

unread,
Mar 24, 2013, 5:26:49 PM3/24/13
to bungeni-editor
Hi Samar --

Lets connect on Google chat on Tuesday morning and we go through the
steps together --

Ashok

Samar Ayesh

unread,
Mar 25, 2013, 3:51:10 AM3/25/13
to bungeni...@googlegroups.com
mm.. could it be on Thursday? .. cause the university is on strike on Tuesday and Wednesday  this week

Samar Ayesh

unread,
Mar 25, 2013, 4:53:50 AM3/25/13
to bungeni...@googlegroups.com
I create routerCreateTable and left it's code the same as routerCreateSection .. and Connected the router to a user action via the toolbar actions infrastructure..
using the editor I created a table and marked it .. the content.xml file for it is attached .. I saw the table content as I tried to provide ..
till now is it ok and what steps are missing in order to get a table in AN xml file?
content.xml

Ashok Hariharan

unread,
Mar 25, 2013, 8:12:30 AM3/25/13
to bungeni...@googlegroups.com
You need to add the xslt template mappers , add the following to type_meta_identi_publi_generator.xsl after the template for text:p  :

<xmeta:template match="table:table">
     <table id="{@table:name}">
        <xmeta:apply-templates />
     </table>
 </xmeta>

 <xmeta:template match="table:table-row">
     <tr>
        <xmeta:apply-templates />
     </tr>
 </xmeta>
 
 <xmeta:template match="table:table-column">
     <td>
        <xmeta:apply-templates />
     </td>
 </xmeta>
        
        


--

Samar Ayesh

unread,
Mar 25, 2013, 8:57:16 AM3/25/13
to bungeni...@googlegroups.com
I did that but didn't get the table in An xml output?
I may change on routerCreateTable ?

Ashok Hariharan

unread,
Mar 26, 2013, 6:19:34 AM3/26/13
to bungeni...@googlegroups.com
There was an additional mapping required in type_static_templates.xsl , see :

http://code.google.com/p/bungeni-editor/source/detail?r=3000

I have added support exporting tables to AN

Samar Ayesh

unread,
Mar 28, 2013, 3:53:50 AM3/28/13
to bungeni...@googlegroups.com
I added the xslt mapping as required .. and this the resulting odt file .. still table are not shown on AN xml file!
PS_leg_cnst_213_23.odt

Ashok Hariharan

unread,
Mar 28, 2013, 5:43:02 AM3/28/13
to bungeni...@googlegroups.com
On 28 March 2013 10:53, Samar Ayesh <smr....@gmail.com> wrote:
I added the xslt mapping as required .. and this the resulting odt file .. still table are not shown on AN xml file!


You just need to svn up since those files are pulled in from externals ... remember dont make local changes . 

Ashok

Ashok Hariharan

unread,
Mar 28, 2013, 6:06:25 AM3/28/13
to bungeni...@googlegroups.com
The problem is not with the table .. its with the section called "T" within which you have the table -- it doesnt have any sectionType metadata on it... so the system doesnt know it exists .. 

Ashok

Samar Ayesh

unread,
Mar 28, 2013, 6:15:54 AM3/28/13
to bungeni...@googlegroups.com
Ahaaaa .. Thanks alot Ashok .. it's working now :)
Reply all
Reply to author
Forward
0 new messages