Forum Replies Created
-
AuthorPosts
-
peppobon
MemberSorry,
the mappings config under 2.1 is wrong (cut&paste mistake).
It should be:
<styles>
<paraStyle name=”chapterTitle” targetXpath=”chapter/title”>
<paraStyle name=”titleSect1″ targetXpath=”chapter/sect1/title”>
<paraStyle name=”normal” targetXpath=”chapter/sect1/para”/>
<paraStyle name=”orderedListItem” targetXpath=”chapter/sect1/orderedlist/listitem”/>
<paraStyle name=”figure” targetXpath=”chapter/sect1/figure”/>
<paraStyle name=”table” targetXpath=”chapter/sect1/table”/>
<paraStyle name=”titleSect2? targetXpath=”hapter/sect2/title”>
<paraStyle name=”normal” targetXpath=”chapter/sect1/sect2/para”/>
<paraStyle name=”orderedListItem” targetXpath=”chapter/sect1/sect2/orderedlist/listitem”/>
<paraStyle name=”figure” targetXpath=”chapter/sect1/sect2/figure”/>
<paraStyle name=”table” targetXpath=”chapter/sect1/sect2/table”/>
</paraStyle>
</paraStyle>
</paraStyle>
</styles>
__peppo
peppobon
MemberHi Nick,
here is what I have learned and what I do now for extracting (and eventually roundtripping) arbitrary xml from/to InDesign.
1. Lesson learned
The xml tools provided natively by ID are definitely not adeguate for book-like (i.e. narrative) content. If you want an usable xml structured editing and pdf production environment use Structured FrameMaker (but in the general publishing world this is not usually an option). The ID xml tools are useful only if you are in catalogue/database publishing.
2. My workflow
The solution is definitely starting from an IDML export. Here is what I currently do.
2.1 Edit the ID source
I edit the ID source to apply styles consistently, group figures and tables with their captions and anchor the groups to their relevant positions in the flow; I usually also add xrefs and index entries at this stage. if you do this wisely, you can use this styling also for print production, otherwise you will have to work on a copy of your typesetted file. At the end (the mileage may vary…) I export from Id to IDML.
2.2 Generate a linear xml representation of the ID content
I have developed a library written in Python to abstract the IDML base semantic. I have classes for all the major components of the IDML spec (styles, stories, figures, table, etc.), so I can easily work programmatically on the extracted files. At this stage I essentially have a linear representation of the contents along with the styles used, like in the following example:
<contentRoot>
<content style=”chapterTitle” id=”0″/>
<content style=”titleSect1″ id=”1″/>
<content style=”normal” id=”2″/>
<content style=”orderedListItem” id=”3″/>
<content style=”normal” id=”4″/>
<content style=”titleSect1″ id=”5″/>
<content style=”normal” id=”6″/>
<content style=”figure” id=”7″/>
<content style=”titleSect2″ id=”8″/>
<content style=”normal” id=”9″/>
<content style=”titleSect2″ id=”10″/>
<content style=”normal” id=”11″/>
<content style=”titoloSect1″ id=”12″/>
<content style=”normal” id=”13″/>
<content style=”table” id=”14″/>
</contentRoot>
<styles>
<paraStyle name=”chapterTitle”/>
<paraStyle name=”titleSect1″/>
<paraStyle name=”titleSect2″/>
<paraStyle name=”normal”/>
<paraStyle name=”orderedListItem”/>
<paraStyle name=”figure”/>
<paraStyle name=”table”/>
<charStyle name=”charStyle1″/>
<charStyle name=”charStyle2″/>
</styles>
2.3 Configure the mappings
Given the target DTD/schema you can configure the mapping between tags and styles writing a configuration file like this example (you can easily generate automatically templates to be hand edited):
<styles>
<paraStyle name=”chapterTitle” targetXpath=”chapter/title”/>
<paraStyle name=”titleSect1″ targetXpath=”chapter/sect1/title”/>
<paraStyle name=”normal” targetXpath=”chapter/sect1/para”/>
<paraStyle name=”orderedListItem” targetXpath=”chapter/sect1/orderedlist/listitem”/>
<paraStyle name=”figure” targetXpath=”chapter/sect1/figure”/>
<paraStyle name=”table” targetXpath=”chapter/sect1/table”/>
<paraStyle name=”titleSect2″ targetXpath=”hapter/sect2/title”/>
<paraStyle name=”normal” targetXpath=”chapter/sect1/sect2/para”/>
<paraStyle name=”orderedListItem” targetXpath=”chapter/sect1/sect2/orderedlist/listitem”/>
<paraStyle name=”figure” targetXpath=”chapter/sect1/sect2/figure”/>
<paraStyle name=”table” targetXpath=”chapter/sect1/sect2/table”/>
</styles>
2.4 Add programmatically nesting and inline styling
Now you have all you need to nest automatically the original ID content as per your target DTD/schema. You add inlines as per charStyles definition.
I routinely use this approach to transform from ID to docbook/DITA/custom DTD and it works as a charm.
You can go in the other direction too (but I not have tested this yet): from the target xml you can generate an IDML/ICML file to be imported/placed in an ID template (ICML is an IDML subset that essentially gives you an InCopy file your editors can direcly place into an ID file).
Note than the key phase is as usual 2.1, but you can train editorial/typesetting staff to do that as there is non need of xml expertise. Usually 2.3 can be done by editorial staff from the publisher as well. 2.4 works flawlessy if the original content has a logical flow, nevertheless there are indeed some boundary cases, like a chapterTitle/titleSect2/titleSect1 sequence (which, by the way, is logically flawed).
If you can enforce some across the board consistency in the use of ID styles during the early typesetting phase you can configure an almost automagic conversion workflow.
3. Conclusions
I do think this is a doable ID xml last workflow!
Contact me privately (peppobon at gmail dot com) if you need more complete examples.
Cheers,
__peppo
-
AuthorPosts
