Mapping XML Tags to Styles Indesign Scripting
Hi guys, so i've uploaded a xml file to my current document. I'm working through this api and i'm currently trying to style the xml tags that I have imported using a template. Please take a look at my code and tell me what I am missing.
Setup.js:
var myDocument = app.open(File(app.activeScript.parent.fsName + '/firstTemplate.indt'));
var curFile = app.activeScript.parent.fsName + '/library.xml';
myDocument.importXML(File(curFile));
// need to apply styling to tags
myDocument.mapXMLTagsToStyles();
var root = myDocument.xmlElements[0]; // root
var element = root.xmlElements[0];
root.placeXML(myDocument.textFrames[0]);
myDocument.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.points;
myDocument.viewPreferences.verticalMeasurementUnits = MeasurementUnits.points;
myDocument.viewPreferences.rulerOrigin = RulerOrigin.pageOrigin;
var price = root.evaluateXPathExpression('//pricing');
My Indt file has paragraph stylings that are to be applied to any document I run the script on just as long as the same xml tags match up to the styling.
Thank you!
