Skip to main content
Alan Houser
Community Expert
Community Expert
Sep 27, 2018 2:13 PM UTC
Answered

Invoking XSLT from Extendscript - where to put the XSLT file?

I'm growing increasingly fond of invoking XSLT from FrameMaker Extendscript. I can now consolidate formerly multi-tool, multi-step workflows into a single Extendscript.

But ... in scripts for distribution to others, I don't know where to put the XSLT file. FrameMaker wants a fully-qualified path for the XSLT stylesheet. My AppData folder seems right for "me", but the path will vary with the user. And without a fully-qualified path, FrameMaker looks for the XSLT stylesheet in the FrameMaker application folder -- not really an option because of Windows filesystem protections.

I don't want to tell my customers to "edit the Extendscript to point to your copy of the XSLT stylesheet". I could set the location in a config file, but even that doesn't seem optimal. How have others handled this issue?

-Alan

--

Alan Houser

Group Wellesley, Inc.

Consultant and Trainer, Technical Publishing

arh on Twitter

412-450-0532

This topic is closed to new replies. Start a new post to keep the conversation going.
Ian Proudfoot
Ian ProudfootCorrect answer
Legend
Sep 27, 2018 2:39 PM UTC

Hi Alan,

You can refer to the user's AppData folder like this:

$.getenv ('AppData');

On my system that gives me the path of the User's AppData/Roaming folder.

~Ian

6 replies

4everJang
Legend
Sep 11, 2023 7:25 PM UTC

All of my code - Extendscript binaries, support files, XSL, etc are always placed in the user's AppData space. The main reason is that I have very quickly become bored with paranoid IT staff when asked to install some very useful timesaving scripts for their documentation people. That simply never worked. The user's AppData space belongs to the user and with today's enormous hard drives there is not really a valid reason not to replicate the code into each user's AppData space - as long as your code contains a command that allows easy updating from some network location.

Translate
Ian Proudfoot
Ian ProudfootCorrect answer
Legend
Sep 27, 2018 2:39 PM UTC

Hi Alan,

You can refer to the user's AppData folder like this:

$.getenv ('AppData');

On my system that gives me the path of the User's AppData/Roaming folder.

~Ian

Translate
Alan Houser
Community Expert
Community Expert
Sep 27, 2018 2:46 PM UTC

Ian,

Thank you! I should have asked if the standard FrameMaker environment variables are available in Extendscript. You've answered my question!

-Alan

Translate
Ian Proudfoot
Legend
Sep 27, 2018 2:55 PM UTC

Pleased to help. There's another way which may work, but I've had problems with previously...

When you use ExtendScript's File or Folder objects you can use a tilde to indicate the user's home directory like this:

~/MyAppFolder/ which, on my system, would map to C:\Users\Ian\MyAppFolder\

Ian

Translate