Thomas Dumm wrote:
>  
> I have a question concerning Table-Editing. I manage to edit CALS-Tables
> with the Table-Editor. But I would like that XMLMind automatically
> inserts/deletes a an element "colspec" if an column is inserted/deleted. 
> 
> I found something on the web
> (http://tech.groups.yahoo.com/group/dita-users/message/8905), but it does
> not work. I know that you are not responsible for other peoples code, but
> maybe you see why the code does not work. Any help would be great, as this
> is beyond my Xpath, etc abilities. As I said: The CALS-Table-Editor
> (insering/deleting, etc) works fine. But custom.checkColspecs does not seem
> to cause any action.
> 
> By the way: Are there any feature anhancements in the
> "com.xmlmind.xmleditapp.tableedit.GenericTableEdit" in XMLMind Version 4? 

Most of the enhancements in v4.0 are related to inclusions. Therefore 
the answer is yes: The table editing commands of XXE v4.0 allow to edit 
tables containing included elements. This was not the case with XXE v3 
which used to gray out all the table editing commands in such case.




I'm really sorry but it is very difficult for me to help you making the 
following macro work. Writing complex macros such as the following one 
is definitely not recommended.

Now, I wonder why your CALS table is called "Table" and not "table" (no 
matter the namespace).

If your table element were called "table" and "Table", you could have 
used the CALS table editor rather than the  generic table editor. The 
CALS table editor automatically inserts colspec elements *when* *needed* 
*to* (for example, when a cell spans several columns). See 
http://www.xmlmind.com/xmleditor/_distrib/doc/configure/html_cals_table.xml.html




> 
> 
>   <command name="gre.GenericTableEdit">
>     <class>com.xmlmind.xmleditapp.tableedit.GenericTableEdit</class>
>   </command>
>   
>  <property name="gre.GenericTableEdit.tableSpecification"> 
>     table=Table tgroup 
>     rowGroup=tbody thead tfoot 
>     row=row 
>     cell=entry
>     rowSpan=morerows+1 
>   </property> 
>  
>   <command name="gre.tableEdit">
>     <macro>
>       <sequence>
>         <command name="gre.GenericTableEdit" parameter="%*"/>
>         <command name="custom.checkColspecs" />
>       </sequence>
>     </macro>
>   </command>
> 
>   <command name="custom.checkColspecs">
>     <macro>
>       <sequence>
>         <set variable="cscount"
> expression="count(ancestor-or-self::Table/tgroup/colspec)"
> context="$implicitElement"/>
>         <set variable="cols"
> expression="ancestor-or-self::Table/tgroup/@cols"
> context="$implicitElement"/>
>         <choice>
>           <sequence>
>             <test expression="$cscount != $cols"/>
>             <command name="selectNode"
> parameter="ancestorOrSelf[implicitElement] Table"/>
>             <command name="selectNode" parameter="child tgroup"/>
>             <get expression="concat($cscount,' ',$cols)"/>
>             <command name="custom.adjustColspecs" parameter="%_"/>
>             <command name="cancelSelection"/>
>           </sequence>
>           <command name="cancelSelection"/>
>         </choice>
>       </sequence>
>     </macro>
>   </command>
> 
>   <command name="custom.adjustColspecs">
>     <macro>
>       <sequence>
>         <set variable="cscount" expression="%0" plainString="true"/>
>         <set variable="cols" expression="%1" plainString="true"/>
>         <command name="selectNode"
> parameter="ancestorOrSelf[implicitElement] tgroup"/>
>         <command name="selectNode" parameter="firstChild[implicitElement]"/>
>         <choice>
>           <sequence>
>             <test expression="$cols &gt; $cscount"/>
>             <command name="insert" parameter="before[implicitElement]
> colspec"/>
>             <get expression="concat(($cscount+1),' ',$cols)"/>
>             <command name="custom.adjustColspecs" parameter="%_"/>
>           </sequence>
>           <sequence>
>             <test expression="$cscount &gt; $cols"/>
>             <command name="delete" parameter="[implicitElement]"/>
>             <get expression="concat(($cscount-1),' ',$cols)"/>
>             <command name="custom.adjustColspecs" parameter="%_"/>
>           </sequence>
>         </choice>
>       </sequence>
>     </macro>
>   </command> 
> 



Reply via email to