Page 1 of 1

duplicate w:bookmarkStart names cause duplicate fo ids

PostPosted: Tue Dec 06, 2011 7:16 pm
by jeromyevans
Hi,
I've encountered a situation where a human-generated Word Document contains multiple bookmarks with the same name. This causes a duplicate ID error in the generated FO when attempting to transform it to PDF.

The extracted fragment of flat opc xml may look like this:
Code: Select all
<w:bookmarkStart w:id="1" w:name="d0e124"/>
<w:bookmarkEnd w:id="1"/>
...
<w:bookmarkStart w:id="0" w:name="d0e124"/>
<w:bookmarkEnd w:id="0"/>


When this document is transformed to FO for PDF the XSLT generates two fo:inline's with the same id:
Code: Select all
<fo:inline id="d0e124"/>

because the XSTL uses the name attribute as id:
Code: Select all
<xsl:template match="w:bookmarkStart" >
...
<fo:inline id="{@w:name}/>
...


I've worked-around this by overriding the XSTL in the classpath, but is this:
- an error in the word document? (i.e. should not allow duplicate names)
- an error in generation of the ID of the inline element? (i.e. not considering duplicate names)

In the sample document the two empty bookmarks are descendants of the same table.
(<w:tbl><w:tr><w:tc><w:p><w:bookmarkStart>)

Regards,
Jeromy Evans