I am in the process of creating a transformation for OpenOffice.org's native XML files and have run into a hitch. Because of the nature of the OOo documents, I cannot have nested paragraph styles within other paragraph styles. What I need is a template that will match everything between the "BeginIntroduction" and "EndIntroduction" nodes in the XML below, and wrap it in <introduction></introduction> tags.
Code:
<office:body>
<text:p text:style-name="Standard">
<text:span text:style-name="ChapterNumber">1</text:span>
</text:p>
<text:p text:style-name="Standard">
<text:span text:style-name="ChapterTitle">Title</text:span>
</text:p>
<text:p text:style-name="BeginIntroduction">Begin Introduction</text:p>
<text:p text:style-name="InlineHeading">inline heading</text:p>
<text:p text:style-name="Normal">text</text:p>
<text:p text:style-name="Normal">text</text:p>
<text:p text:style-name="Normal">text</text:p>
<text:p text:style-name="Normal">text</text:p>
<text:p text:style-name="EndIntroduction">End Introduction</text:p>
<text:p text:style-name="InlineHeading">inline heading</text:p>
<text:p text:style-name="Normal">text</text:p>
<text:p text:style-name="Normal">text</text:p>
<text:p text:style-name="Normal">text</text:p>
<text:p text:style-name="Normal">text</text:p>
</office:body>
The ideal transformation should look like this:
Code:
<root>
<ChapterNumber>1</ChapterNumber>
<ChapterTitle>title</ChapterTitle>
<Introduction>
<InlineHeading>heading</InlineHeading>
<Paragraph>text</Paragraph>
<Paragraph>text</Paragraph>
<Paragraph>text</Paragraph>
<Paragraph>text</Paragraph>
</Introduction>
<InlineHeading>heading</InlineHeading>
<Paragraph>text</Paragraph>
<Paragraph>text</Paragraph>
<Paragraph>text</Paragraph>
<Paragraph>text</Paragraph>
</root>
Is this going to be possible? Or do I need to consider some different options? Also, it is important for me to note that I actually do have control over the "BeginIntroduction" and "EndIntroduction" tags. I can change the name of them, but they have to be siblings of the paragraphs.
So, for example, instead of:
Code:
<text:p text:style-name="BeginIntroduction">Begin Introduction</text:p>
...
<text:p text:style-name="EndIntroduction">End Introduction</text:p>
I could make it:
Code:
<text:p text:style-name="Introduction">Introduction</text:p>
...
<text:p text:style-name="Introduction">Introduction</text:p>
That is the extent of the control I have.
Thanks in advance for any advice!!!
Aaron