• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Duplicate XML Element - label and caption

Contributor ,
Sep 02, 2016 Sep 02, 2016

Copy link to clipboard

Copied

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

TOPICS
Scripting

Views

321

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Sep 02, 2016 Sep 02, 2016

Copy link to clipboard

Copied

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/

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Sep 02, 2016 Sep 02, 2016

Copy link to clipboard

Copied

LATEST

Hi Loic,

Thanks to your reply! and good suggestions Thanks.

Thanks

KS

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines