0 Replies Latest reply on Aug 13, 2011 3:43 AM by M Karthik

    cals table and indesign cs3 (script)

    M Karthik Level 1

      I have xml file like:

       

      <?xml version="1.0" encoding="utf-8"?>
      <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1//EN/" "docbookx.dtd">
      <book>
      <chapter>
      <chapterinfo><title>Chapter 1</title></chapterinfo><title> Introduction</title>
      <toc>
      <title>Chapter Outline</title>
      <sect1><title>1.1 INTRODUCTION</title>
      <para>Humans</para>
      <table>
      <title>Table 1.1 Information </title>
      <tgroup cols="2">
      <tbody>
      <row><entry><para><emphasis role="italics">Information Details</emphasis></para></entry><entry><para><emphasis role="italics">Data</emphasis></para></entry></row>
      <row><entry><para>Name</para></entry><entry><para>Satish</para></entry></row>
      <row><entry><para>Gender</para></entry><entry><para>Male</para></entry></row>
      <row><entry><para>Age</para></entry><entry><para>23</para></entry></row>
      <row><entry><para>Phone</para></entry><entry><para>23234507</para></entry></row>
      <row><entry><para>City</para></entry><entry><para>Pune</para></entry></row>
      </tbody>
      </tgroup>
      </table>
      </sect1>
      </chapter>
      </book>

       

      While i import the xml file its converted to the table format. Now i need to apply the table caption style using the script.
      Here my script

       

       

      #include "glue code.jsx"
      
      main();
      function main(){
          if (app.documents.length != 0){
              var myDocument = app.documents.item(0);
              var myRuleSet = new Array ( new TT);
              with(myDocument){
                  var elements = xmlElements;
                  __processRuleSet(elements.item(0), myRuleSet);
              }
      
          alert("it's over");
          }
          else{
              alert("No open document");
          }
      
      //TABLE
      //*******
          function TT(){
              this.name = "TT";
              this.xpath = "//table/title";    
              this.apply = function(myElement, myRuleProcessor){
                  with(myElement){
              insertTextAsContent("\r", XMLElementPosition.afterElement);
              applyParagraphStyle(myDocument.paragraphStyles.item("#Table title"));
                  }
                  return true;
              }
          }    
      }    
      

       

      While run the script, its not show any error. Also it it not applying the table caption style. Please help me, what is my error....

       

      Thanks

      Karthik