Positional Grouping

A

Andy

Hi
I'm having difficulties with positional grouping.
I have a wordML fragment that looks something like this:

<ns0:Body>
<w:p>
<w:pPr>
<w:pStyle w:val="BodyHeading"/>
</w:pPr>
<w:r>
<w:t>Subject Matter</w:t>
</w:r>
</w:p>
<w:p>
<w:pPr>
<w:pStyle w:val="NumberedText"/>
</w:pPr>
<w:r>
<w:t>Some list text</w:t>
</w:r>
</w:p>
<w:p>
<w:pPr>
<w:pStyle w:val="Text"/>
</w:pPr>
<w:r>
<w:t>Some text</w:t>
</w:r>
</w:p>
<w:p>
<w:pPr>
<w:pStyle w:val="BodyHeading"/>
</w:pPr>
<w:r>
<w:t>Subject Matter 2</w:t>
</w:r>
</w:p>
<w:p>
<w:pPr>
<w:pStyle w:val="Text"/>
</w:pPr>
<w:r>
<w:t>Some more text</w:t>
</w:r>
</w:p>
<w:p>
<w:pPr>
<w:pStyle w:val="NumberedText"/>
</w:pPr>
<w:r>
<w:t>Some more list text</w:t>
</w:r>
</w:p>
</ns0:Body>

I need to transform this XML into another XML Schema format which
requires paragraphs in the "Body" to be structured in this way

<Body>
<Section>
<Title>Subject Matter</Title>
<List>
<ListItem>Some list text</List>
</List>
<Para>Some text</Para>
</Section>
<Section>
<Title>Subject Matter 2</Title>
<Para>Some more text</Para>
<List>
<ListItem>Some more list text</List>
</List>
</Section>
</Body>

I have no control over the number of paragraphs that the Body will
contain and I think I need to use the w:pStyle attribute to identify
which paragraphs need to become Section headings. As you can see all
the paragraphs after a BodyHeading paragraph need to be children of the
BodyHeading paragraph (which becomes a <Section>) until another
BodyHeading is found at which time the process starts again.

I am using XSL version 1.0 and am in big trouble.
Can anyone help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,586
Members
45,097
Latest member
RayE496148

Latest Threads

Top