1 Reply Latest reply on Sep 3, 2008 1:43 AM by (Vivek_Singh)

    Apply Paragraph Styles by XML-Rule Set

        • 1. Re: Apply Paragraph Styles by XML-Rule Set
          Level 1
          Hi Friends,
          I am new in InDesign JavaScript and i have to work with InDesign.
          My problem is that i am reading the xpath string and paragraph style from the text file and i want to apply this paragraph style to the xpath. i try to pass the parameters to the XML-Rule Set function but the apply function does not work with the value.

          This is my text file Content

          xpath inddStyleType inddStyleName
          //para para body_text
          //section-title para section_text

          and my Script file is looks like

          if(inddStyleType == "para"){
          var paraStyle = currentDoc.paragraphStyles.item(inddStyleName);
          var myRuleSet = new Array (new applyReturn(workingXPath),
          new applyParaStyle(workingXPath, paraStyle));
          var elements = xmlElements;
          __processRuleSet(elements.item(0), myRuleSet);

          function applyReturn(XPATH){
          this.name = "applyReturn";
          this.xpath = XPATH;

          this.apply = function(workingElement, workingRuleProcessor){
          insertTextAsContent("\r", XMLElementPosition.afterElement);
          return true;

          function applyParaStyle(XPATH, styleName){
          alert("applyParaStyle \nXPath --->"+XPATH+"\nStyle Name -->"+styleName);
          this.name = "applyParaStyle";
          this.xpath = XPATH;
          var ParaStyle = styleName;
          this.apply = function(workingElement, workingRuleProcessor){
          workingElement.applyParagraphStyle(styleName, true);
          return true;

          Thanks in Advance
          Vivek Singh