-
1. Re: Please correct this script for call xml element
Luc Lorent Aug 1, 2014 6:37 AM (in response to hasvi)You can map tags to styles, but since the H1 and H2 of your 2nd issue have the same "title"-tag, it is normal that they map to the same style.
I would use an XSLT on import of the XML-file. The XSLT can change the "title" tags to for example: H1 and H2.
-
2. Re: Please correct this script for call xml element
hasvi Aug 4, 2014 2:05 AM (in response to Luc Lorent)Hi,
can you show me that xslt for declare the style tags
by
hasvi
-
3. Re: Please correct this script for call xml element
Luc Lorent Aug 4, 2014 2:52 AM (in response to hasvi)No, not really.
I know it can be done that way and i've done similar things, but i have no example which processes attributes.
-
4. Re: Please correct this script for call xml element
Chinnadk Aug 4, 2014 11:42 PM (in response to hasvi)Hasvi,
Try this.
#include "glue code.jsx"; var doc = app.activeDocument, ruleSet = new Array (new AddReturns); __processRuleSet(doc.xmlElements.item(0), ruleSet); function AddReturns() { this.name = "MapStyles"; this.xpath = "//section[@id]"; this.apply = function(element) { if(element.xmlAttributes.itemByName("id").value === 'ch01lev1sec1') { element.applyParagraphStyle('H1') } if(element.xmlAttributes.itemByName("id").value === 'ch01lev2sec1') { element.applyParagraphStyle('H2') } } }Regards,
Chinna
-
5. Re: Re: Please correct this script for call xml element
vandy88 Aug 5, 2014 12:21 AM (in response to Chinnadk)Hi Chinna,
There is some problem in your script, your code applying heading styles for all the text in the section tag, I have done some minor correction.
#include "./XML Rules/glue code.jsx" var doc = app.activeDocument, ruleSet = new Array (new AddReturns); __processRuleSet(doc.xmlElements.item(0), ruleSet); function AddReturns() { this.name = "MapStyles"; this.xpath = "//title"; this.apply = function(element) { if(element.parent.markupTag.name == "section" && element.parent.xmlAttributes.itemByName("id").value === 'ch01lev1sec1') { element.applyParagraphStyle('H1'); } if(element.parent.markupTag.name == "section" && element.parent.xmlAttributes.itemByName("id").value === 'ch01lev2sec1') { element.applyParagraphStyle('H2'); } } }Vandy
-
6. Re: Please correct this script for call xml element
Chinnadk Aug 5, 2014 1:24 AM (in response to vandy88)Thanks Vandy.
-
7. Re: Please correct this script for call xml element
hasvi Aug 6, 2014 11:41 PM (in response to Chinnadk)Thanks chinna
-
8. Re: Please correct this script for call xml element
hasvi Aug 9, 2014 3:47 AM (in response to vandy88) -
9. Re: Please correct this script for call xml element
vandy88 Aug 9, 2014 5:31 AM (in response to hasvi)Use full path,
#include "/C/Program Files/Adobe/Adobe InDesign CS5.5/Scripts/XML Rules/glue code.jsx"
Vandy






