I first set out to do this with XSLT, then with PHP. Now i'll have to have a go at it with Indesign scripting (javascript probably)
My problem is that i have an indesign file without structure (nothing is tagged, but everything has a paragraph style)
Wat i have to do is 1) ad tags to paragraphs based on their styles 2) deepen the structure by adding parent-elements to the tags
An example:
This text:
Titel 1 (style = title1)
Titel 2 (style = title2)
some text (style = text1)
listitem 1 (style = listitem)
listitem 2 (style = listitem)
Has to become (on export to XML)
<GR.SEQ level="1">
<TITLE>
<TI>
<HT>
Titel 1
</HT>
</TI>
</TITLE>
<GR.SEQ level="2">
<TITLE>
<TI>
<HT>
Titel 2
</HT>
</TI>
</TITLE>
<P>
some text
</P>
<LIST>
<ITEM>
<ITEM.CONT>
listitem 1
</ITEM.CONT>
</ITEM>
<ITEM>
<ITEM.CONT>
listitem 2
</ITEM.CONT>
</ITEM>
</LIST>
</GR>
</GR>
Any help is appreciated! a code-example that does this would be marvelous but a push in the right direction is also very welcome.
I would be very pleased already when i could change this:
Titel 1
to this
<TITLE>
<TI>
<HT>
Titel 1
</HT>
</TI>
</TITLE>