2 Replies Latest reply on Sep 2, 2016 5:57 AM by karthiks94217840

    Duplicate XML Element - label and caption

    karthiks94217840 Level 2

      Dear Friends,

       

      I need your help

       

      How to duplicate XML Element for label and caption text?

      My need: Example below:

       

      Label >> Table A2.8 >> skip A2.8 >> A2.8-separate text (just alert)

      Caption >> Hellow work >> Hellow work-separate text (just alert)

       

      Table A2.8. Hellow Word

       

      (to)

       

      A2.8. Hellow Word >> (separate text frame) Duplicate XML Element.

       

      This is possible to script? i don't how to start and end. Please suggest friends. I have place the screenshot below:

       

       var tableTableCapXpath = "//jrnlTblBlock/p[@aid:pstyle='jrnlTblCaption']/bold/label"; //Duplicate label part
       var tableXMLElementCap = curDoc.xmlElements[0].evaluateXPathExpression(tableTableCapXpath); 
                                        
       var tableTableCapXpath = "//jrnlTblBlock/p[@aid:pstyle='jrnlTblCaption']"; //Duplicate caption part
       var tableXMLElementCap = curDoc.xmlElements[0].evaluateXPathExpression(tableTableCapXpath); 
      

       

      XXX.png

       

      Please help and suggest friends

       

      Thanks in Advance

      KS

        • 1. Re: Duplicate XML Element - label and caption
          Loic.Aigon Adobe Community Professional

          Not sure what you want to do exactly but xpath won't duplicate a xmlElement because it let you just target the nodes you are interested in.

           

          However EvaluateXPathExpression will return an array of XMLElements if any is found.

           

          var myXMLElements = someXMLElement.evaluateXPathExpression( someXPath ); //array of XMLElements objects

           

          In the latter, you can reference a member of that array and call a regular duplicate method.

           

          var sourceXMLElement = myXMLElements[0]; //A reference to the first child of the array

           

          then duplicate

          var dup = sourceXMLElement.duplicate();

           

          It will copy the xmlElement just after the source so you may want to move the copy somewhere else;

          dup.move ( LocationOptions.AFTER, someReferenceXMLElement );

           

           

          FWIW

           

          Loic

          http://www.ozalto.com/

          • 2. Re: Duplicate XML Element - label and caption
            karthiks94217840 Level 2

            Hi Loic,

             

            Thanks to your reply! and good suggestions Thanks.

             

             

            Thanks

            KS