Skip to main content
Jackkisten
Inspiring
March 30, 2016
Question

How find the following-sibling::, preceding-sibling:: & parent:: element and attributes using evaluateXPathExpression option in indesign

  • March 30, 2016
  • 3 replies
  • 1249 views

Dear All,

How find the following-sibling::, preceding-sibling::  & parent:: element and attributes using evaluateXPathExpression option in indesign.

Please suggest me best way to find xml element and attributes.

Regards,

~Jackkisten

This topic has been closed for replies.

3 replies

Loic.Aigon
Brainiac
March 31, 2016

Well, you can still use evaluateXPathExpression to retrieve xmlElements and once grabbed look for following/preceeding-siblings by using indeces or collection nextItem(), previousItem() special functions.

For parent, you can use…parent property of any xmlElement…

FWIW,

Loic

Jackkisten
Inspiring
April 1, 2016

Hi Loic,

Could you possible to give some example and sample code for evaluateXPathExpression, collection.

Thanks in advance!!

Regards,

~Jackkisten

Loic.Aigon
Brainiac
April 1, 2016

XPATH : XPath Syntax

evaluateXPathExpression:Adobe InDesign CS6 (8.0) Object Model JS: XMLElement

Sample codes all around…

Jackkisten
Inspiring
March 31, 2016

Hi All,

Then how we can use xpath in indesign to find the xml node

Loic.Aigon
Brainiac
March 30, 2016

Hi

Be aware xpath implementation in ExtendScript is all but exhaustive. Most of those axes won't work.

Due to the one-pass nature of this implementation, the following XPath expressions are specifically

excluded:

No ancestor or preceding-sibling axes, including .., ancestor::, preceding-sibling::.

See xpath limitations in Adobe Scripting guide for more details.

Loic

Ozalto | Productivity Oriented - Loïc Aigon