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

4
  • 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 frameless.io/xslt is another attempt to implement XSLT 2.0 in Javascript, but again inside of browsers as client-side Javascript. Aug 13, 2015 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, 2015 at 9: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. Aug 17, 2015 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 Aug 17, 2015 at 17:41

1 Answer 1

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.

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.