0

this is my first post here

I am developing a set of scripts (JS/ExtendScript) for Indesign to automate catalogue production. The input data is xml. Sometimes it could be very handy to rearrange xml on an early stage with xslt but I can't figure out a way to do it. There are some js xslt libraries out there, but they all are basically wrappers for browser xslt engines that need an open browser window and a document in it.

I know I can always do an external xslt transformation with libproc or similar and even write a shell/batch script for it, but than it won't be a one click solution for my client anymore.

Questions: does anybody know a standalone js xslt module? Is there a way for a script to talk directly to Chrome(?) xslt engine without opening documents? Any other way to do it?

Thanks a lot! L

  • Browsers don't have XSLT processors implemented in Javascript, they integrate (Chrome: libxslt, IE: MSXML) or come with (Mozilla: Transformix) XSLT 1.0 implementations done in C or C++. Saxon-CE is a Javascript implementation (cross-compiled from the Java version of Saxon 9) of XSLT 2.0, but it also works in the browser only. Finally http://frameless.io/xslt/ is another attempt to implement XSLT 2.0 in Javascript, but again inside of browsers as client-side Javascript. – Martin Honnen Aug 13 '15 at 14:03
  • InDesign comes with a basic XSLT engine built in - from memory, XSLT 1.0. "I can't figure out a way to do it" > Click 'use XSLT' in the Import XML dialog... – Jongware Aug 16 '15 at 09:58
  • Hi @Jongware, thank you for your comment. The problem is, for some complicated reasons I get my XML through var foo = new XML, and than read a file in it. – Alexey Tuboltsev Aug 17 '15 at 17:33
  • Hi Maritn, hi @Jongware, thank you for your comments. The problem is, for some complicated reasons I get my XML through var foo = new XML, and than read a file in it. I actually found a standalone xpath/xslt library - ajaxslt, but it relies on browser DOM too, and I don't seem to have enough experience to write an InDesign API for it. I guess the best way is through xsltproc. ups, sorry for double post – Alexey Tuboltsev Aug 17 '15 at 17:41

1 Answers1

0

I am guessing you will always need to output a XML file at some point. You can then as Jongware suggested use InDesign XSLT engine (you can even use a temporary document to import through XSLT and get the XML file exported for further processing). Another approach is to call a shell script through doScript and lay on a command line tool such as Saxon.

Loic
  • 2,173
  • 10
  • 13