Join Chad Chelius for an in-depth discussion in this video Mapping tags to styles, part of Creating an InDesign Booklet Using XML.
- We have our document structure based on the XML content we'll be importing. But we're missing an important component from a design standpoint: the formatting. Don't think for a second that I forgot about it. It's just easier to focus on the structure first, and then dial in the formatting afterwards. Now, we can certainly manually go through this and format the content, but again, InDesign provides a more effective method by connecting the tags in our XML content to the InDesign styles in the document. Again, another important reason to use styles in InDesign.
This feature is called Map Tags to Styles. So, with my Mapping.indb file open here, we can access the mapping instructions in a couple of different places. One area we can do this is by going to the Tags panel. I'm going to go to Window Utilities, Tags, and in the panel menu, you'll notice that we have the option to map the tags to styles right here. Another way we can do this is by opening up our Structure pane. So if we go to the View menu, under Structure, and choose Show Structure, we can click on the Panel menu here and access the command right here.
Now, a common question I get asked is, is there a difference between Map Tags to Styles and Styles to Tags? Of course there is, and the way you need to think about this is, you have to look at your document and think, what do I have in this document? In our example, we have tagged content in the layout, so we want to map those tags to the styles in the document. Now, other workflows in InDesign involve taking formatted content and tagging them using XML tags.
In a case like that, you already have the styles, so we would want to use the Map Styles to Tags as well. Remember, you can output XML out of InDesign just as easily as you can import it. So, we're going to go ahead and choose Map Tags to Styles, and that's going to bring up our Map Tags to Styles dialog box. Now, on the left-hand side, you're going to see all of the tags that exist in this document, and then over here, on the right-hand side, you can choose a style to apply to those tags.
Now, you can make decisions here. You don't have to map them all if you don't want to, and what I'm going to do is move this down a little bit, so we can see what we're doing, and I'm going to turn my Preview on. So, I'm going to focus on the styles that are really doing most of the formatting here. So, one of the things I'm going to do is come up here and click on Category. And if I click on the drop-down menu, I can choose a style to apply to this tag. So, the style I'm going to use is Flower Type, and you'll notice, the minute I do that, that text gets formatted with that style.
Looking pretty good. Now, I'm going to go down here to Description, and I'm going to click on the drop-down menu, and choose Flower Description. If I move down here, we're going to start to see the formatting being applied. Now, the next thing is Flower. Click on the drop-down menu, and I'm going to choose Flower Name. Again, if I move this down, you can see that "zinnias" is now being formatted. Flower Inventory, that is the parent tag, and that is really the whole entire thing, so I'm not going to map that one.
The next thing I'm going to do is come down here to the Variety, I'm just just going to jump down to Variety, because that's really what's doing the formatting for the listings here. So I'm going to click on the drop-down, and I'm going to choose Flower Variety. Now, one of the mechanisms you can use when you're mapping your tags to styles is that, if you name your style the same name as the tag, you can simply click the Map By Name button, and everything will just map automatically for you. So, it depends on your workflow and how you want to configure your document.
Now, I want to get a little bit more granular here, so what I'm going to do is, where it says Quantity, I'm going to click on the drop-down, and I'm going to apply the Italic character style to that text. And, it's hard to see here, but you can see that that is now italicized. I'm going to also click on Price, and I've created a Price character style for that text as well. Now I'm going to go ahead and click OK, and now you're going to be able to see how this content is formatted. Now, if you notice, the static text in this listing is not getting formatted, because it's not part of the tag itself.
So, of course I could go ahead and manually highlight this, but again I like to get InDesign to do this for me. So the approach that I'm going to take is I'm going to incorporate a nested style into my paragraph style. So, for Flower Variety, what I'll do is right-click on this, and choose Edit. It's going to bring up this giant dialog box here, that's okay. I'm going to click on Drop Caps and Nested Styles, and I'm going to click on New Nested Style, and I'm going to apply None up to one, and then I'm going to type a physical open parens.
So there you go. And it's essentially doing nothing up to that point. And I'm going to click New Nested Style again, and I'm going to tell it to apply Italic through one, closing parens. So, just highlight that, type a closing parens, and if I turn the preview on, you're going to see that this whole thing is now formatted, using that character style. Click New Nested Style again, I'm going to apply the Leader character style through one, Tab Character.
Again, if I click down here, it's going to start to update that, and that just kind of spaces out this leader here, and then I'm going to click New Nested Style, and tell it to apply the Price style through one, and Words is going to be fine in this example. We could say through One Sentence, because we're really finishing it up at the end here. And, again, all this is doing is automating some of the work for me, so that, moving forward, I know that everything is going to be formatted the way I want it to be.
So, I'm going to zoom out here, and so, you can see that, by making that connection between the XML tags and the InDesign styles, we can ensure consistent formatting of the documents in our XML workflow, and probably equally importantly, we can make global adjustments to our layout by modifying those styles in InDesign.
In these tutorials, Chad Chelius explains what XML is and then walks through the entire process in InDesign, from setting up the document and tagging the content, to cleaning the data and fine-tuning the layout. He also offers tips for saving your work in an InDesign template, to regenerate directories when new entries are added, update catalogs seasonally, etc. By the end of the course, you should be able to use this workflow to speed up data-heavy design jobs, big and small.
- What is XML?
- Transforming XML
- Displaying tag markers
- Setting up an InDesign document for XML import
- Creating styles
- Tagging content
- Mapping tags to styles
- Importing XML data in InDesign
- Applying master pages
- Creating a table of contents