Well, a better snippet would be best to have. But, attributes are not used in ID anyway. Which is why seeing a better representation of the data would be better to see.
Not knowing what the data is like, I would suggest doing a search and replace in an editor to change the attributes into unique elements.
<icd_text> is a valid XML Element name, without attributes. The other two are not valid XML; and if this indeed is the format of your source text, InDesign's XML parser will reject them.
Well-formed XML (the politically correct term for "correct XML") can be imported as-is into InDesign, but you can only apply paragraph or character styles to elements, not attributes. However: you can apply an XSLT style sheet while importing the XML, which transforms a combination of element + some attribute (with or without a specific value) into a new (unique) element, and then you can have ID apply the correct style automatically.
Well, without the closing tags, et al, the above isn't well-formed anyway
Which is one reason for seeing how the XML really is would help. Most of the time, I find it quicker to run through UltraEdit than modifying an XSL/XSLT for something simple like this. If I do need to mod an XSL file, I will still run it through my XML editor.
<headinga>Primary ICD Code</headinga>
<icd_num>680.2</icd_num><icd_text>Carbuncle and furuncle, Trunk</icd_text>
<icd_text in="1">Abdominal wall</icd_text>
<icd_text in="1">Back (any part, except buttocks)</icd_text>
<icd_text in="1">Chest wall</icd_text>
<icd_text in="2">Pectoral region</icd_text>
This isn't my entire xml file, but I assure you this is valid xml in every sense. I should have included this from the get go. But it imports right into InDesign.
So the answer I'm receiving is that attributes have no place in InDesign. I'm not skilled in XSLT, so I may have to sit down with my colleague to figure out a perl script to search and replace the xml with attributes to have unique beginning and ending tags.
Thanks for the hep!
I figured it was a valid XML file.
See the closing tags for icd_text ? The opening tag that matches minus the attribute flag is all ID is going to see. So each of those elements are considered a single element, therefore they are going to be mapped to a single paragraph style. That's the issue.
A simple search/replace in a decent text editor to change the in="1" part to icd_text1 and the closing tag to /icd_text1,etc., is incredibly quick. And actually, I would do the find any line beginning with the opening tag and change the closing tag on the first pass, then change the opening tag. Of course, using a script would be easier...once the script is written.