InDesignへxslを介してxmlを読み込む方法

散々苦戦したのでメモ書き
環境:Mac OS X/InDesign CS4/
今回の要件
①/Application/MANP/フォルダ内にxml・xslともにある。
②Macintosh HD:Application:~という指定は使わない。
ex.)
var myDocument = app.documents.add();
//–xml読込初期設定–
var myXMLImportPreferences=myDocument.xmlImportPreferences;
//xslでの変換ON
myXMLImportPreferences.allowTransform=true;
myXMLImportPreferences.createLinkToXML=true; //不要?
myXMLImportPreferences.importStyle=XMLImportStyles.mergeImport;
//xslファイルはFile()指定にするのがイイみたい
myXMLImportPreferences.transformFilename=File(“/Application/MANP/xml/test_output.xsl”);
myDocument.importXML(File(“/Application/MANP/xml/test_output.xml”));
補足:
スクリプティングガイドの記述例↓はwindows版しかみつからず、これ。
myXMLImportPreferences.transformFilename=”c:\myTransform.xsl”
myDocument.importXML(File(“/c/xml_test.xml”));
★とりあえずMacに当てはめてみると。。。
これ↓は正常稼働。
myXMLImportPreferences.transformFilename=”Macintosh HD:Application:MANP:xml:test_output.xsl”;
でも要件を満たさないのでこちら↓を試みると、NG
myXMLImportPreferences.transformFilename=”/Application/MANP/xml/test_output.xsl”;
※Windowsではどうなのかは不明。環境ないので。
——————————————————–
追記:
★この時読み込むXSLに、パラメータを渡す方法
設定時これも書く
myXMLImportPreferences.transformParameters = [[“format”, “1”]];
2次元配列で渡すみたい。
[[“パラメーター名”,”値”],[“パラメーター名”,”値”],・・・・] と。
実際は2つ以上は試してないけど。
以下、スクリプティングガイドより
//If you have defined parameters in your XSL file, then you can pass
//parameters to the file during the XML import process. For each parameter,
//enter an array containing two strings. The first string is the name of the
//parameter, the second is the value of the parameter.