I am attempting a workaround for the loss of custom XML in Word's Office Open XML, and I've run into a bit of a snag.
I am working on a way of tracking contributions to a repository of shared lesson plans that will reside in an Omeka site. What I want to be able to do is wrap each character in a bookmark, which would then be hidden from view when the file is opened in Word. This is so that token will carry across when things are copied and pasted offsite, and then reconnected to the original contributor when the new file is uploaded again.
To do this, my XML current looks like this:
<w:p w:rsidR="00196751" w:rsidRDefault="00956712">
<w:r>
<w:t>Some sample text.</w:t>
</w:r>
<w:bookmarkStart w:id="0" w:name="_GoBack"/>
<w:bookmarkEnd w:id="0"/>
</w:p>
What I need it to do is look like this:
<w:p w:rsidR="00196751" w:rsidRDefault="00956712">
<w:bookmarkStart w:id="0" w:name="_NAME_0001_20150616_1"/>
<w:r>
<w:t>S</w:t>
</w:r>
<w:bookmarkStart w:id="1" w:name="_NAME_0001_20150616_2"/>
<w:bookmarkEnd w:id="0"/>
<w:r>
<w:t>o</w:t>
</w:r>
<w:bookmarkStart w:id="2" w:name="_NAME_0001_20150616_3"/>
<w:bookmarkEnd w:id="1"/>
<w:r>
<w:t>m</w:t>
</w:r>
<w:bookmarkStart w:id="3" w:name="_NAME_0001_20150616_4"/>
<w:bookmarkEnd w:id="2"/>
<w:r>
<w:t>e</w:t>
</w:r>
<w:bookmarkStart w:id="4" w:name="_NAME_0001_20150616_5"/>
<w:bookmarkEnd w:id="3"/>
<w:r>
<w:t xml:space="preserve"> </w:t>
</w:r>
[...]
<w:bookmarkStart w:id="17" w:name="_GoBack"/>
<w:bookmarkEnd w:id="16"/>
<w:bookmarkEnd w:id="17"/>
</w:p>
It seems to me that what I'd need to do is run the tokenize function on the original w:t item, so I wrote the following xslt as a first step:
<xsl:template match="w:t">
<xsl:value-of select="tokenize(., '.??')"/>
</xsl:template>
However when I do that I get an error message. My assumption is that this is because there's no actual pattern for the function to tokenize on since I'm asking it to separate on each character. Is there a way to use the tokenize function to do this? If so, how would I do so to get the result I need? Thanks!
You should have a template for this, which you can apply on your original
<w:t>
value:not sure how the w:bookmarkStart and w:bookmarkEnd logic work, but you can probably figure it out from this.