Highlighted

Convert XML tag to index entry in InDesign?

New Here ,
Oct 20, 2020

Copy link to clipboard

Copied

I want to upgrade our university's graduation book using InDesign instead of an ancient version of FrameMaker. Each student is listed in the book with their name, major, minor, thesis title, etc. At the end of the book is an index with each student's name. The data for the book is in an XML file, and I know how to import the XML and use tags, styles, etc. to format it. However, I'm struggling to figure out how to create the index entries.

 

The XML file already includes a tag for index name, e.g.:

 

<STUDENT>

<STUD_NAME>Jennifer Gabrielle Smith</STUD_NAME>

<INDEX_NAME>Smith, Jennifer G.[SMITH, JENNIFER GABRIELLE90210]</INDEX_NAME>

<STUD_TITLE>This is the student's thesis title</STUD_TITLE>
</STUDENT>

 

What is the best method for changing the content within the <index_name> tag (except for what's in straight brackets) to an index entry? Obviously it's not practical to hand-tag thousands of students. Do I have to use a script, or is there some other simpler way?

Most Valuable Participant
Correct answer by Jeffrey_Smith | Most Valuable Participant

Then you will need to use a script, perhaps this one may work. You would apply a character style to the Index name and then run the script.

TOPICS
Scripting

Views

52

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Convert XML tag to index entry in InDesign?

New Here ,
Oct 20, 2020

Copy link to clipboard

Copied

I want to upgrade our university's graduation book using InDesign instead of an ancient version of FrameMaker. Each student is listed in the book with their name, major, minor, thesis title, etc. At the end of the book is an index with each student's name. The data for the book is in an XML file, and I know how to import the XML and use tags, styles, etc. to format it. However, I'm struggling to figure out how to create the index entries.

 

The XML file already includes a tag for index name, e.g.:

 

<STUDENT>

<STUD_NAME>Jennifer Gabrielle Smith</STUD_NAME>

<INDEX_NAME>Smith, Jennifer G.[SMITH, JENNIFER GABRIELLE90210]</INDEX_NAME>

<STUD_TITLE>This is the student's thesis title</STUD_TITLE>
</STUDENT>

 

What is the best method for changing the content within the <index_name> tag (except for what's in straight brackets) to an index entry? Obviously it's not practical to hand-tag thousands of students. Do I have to use a script, or is there some other simpler way?

Most Valuable Participant
Correct answer by Jeffrey_Smith | Most Valuable Participant

Then you will need to use a script, perhaps this one may work. You would apply a character style to the Index name and then run the script.

TOPICS
Scripting

Views

53

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Oct 20, 2020 0
Most Valuable Participant ,
Oct 20, 2020

Copy link to clipboard

Copied

Your example seems more of a table of contents, than an index.

Will it look like this?
Smith, Jeff  p250

Smith, Jennifer  p251

Smith, John  p252

If yes, then use a unique paragraph style applied to your Index name entries, and then use the Table of Content tool to generate the list.

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 20, 2020 0
New Here ,
Oct 21, 2020

Copy link to clipboard

Copied

Thanks, Jeffrey. Close, but not quite. Table of Contents doesn't alphabetize the listings, nor does it include references to multiple pages for the same student. For example, Jennifer Smith might have a double major and be listed twice, on p251 and p17, so the entry should look like:

 

Smith, Jennifer     17, 251

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 21, 2020 0
Most Valuable Participant ,
Oct 21, 2020

Copy link to clipboard

Copied

Then you will need to use a script, perhaps this one may work. You would apply a character style to the Index name and then run the script.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 21, 2020 0
New Here ,
Oct 22, 2020

Copy link to clipboard

Copied

That is indeed the perfect script, thanks so much!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 22, 2020 0