0

I have an xml file with the attribute style inside the resultset

<resultset statement="select adtext  from ad where adCategoryID=3 order by adinsertdate desc limit 100" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" style="cars">

The value of the attribute may vary in different xml files, so I would like to get the value of the attribute and apply the corresponding styling to my xml, according to this value.

However no matter what variations I try in this statement:

if(myTemplate.XMLElement.XMLAttributes.itemByName("style").value == "cars"){//...}

I get the following message:

"Object does not support the property or method 'XMLElement'.

Any help will be appreciated.

Ria S.
  • 63
  • 1
  • 11
  • Take care to **not** mix up the [Class name](http://jongware.mit.edu/idcs6js/pc_XMLElement.html) and the [property name](jongware.mit.edu/idcs6js/pc_XMLElement.html#xmlElements). – Jongware Jul 07 '14 at 15:59
  • So I need to create an XMLElement Object to access the attribute XMLAttributes.Obviously myTemplate is not of that kind of Object though... So I need an XMLElement Object that is found inside myTemplate (which is my document), right? – Ria S. Jul 07 '14 at 16:57
  • Wrong. You cannot "create" these objects as a variable as you would in an actual programming language, you can only *access* existing ones. So use `myTemplate.xmlElements(some_ref_here).xmlAttributes` -- etc. (where `some_ref_here` needs to point to an existing XML element). – Jongware Jul 07 '14 at 17:01
  • So in my case where I import the xml file in myTemplate.indt, what will be my "some_ref_here"? I'm a newbie to InDesign so I can' really figure this out. – Ria S. Jul 08 '14 at 15:43

0 Answers0