Positional Grouping

Discussion in 'XML' started by Andy, Jan 10, 2007.

  1. Andy

    Andy Guest

    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.
    Andy, Jan 10, 2007
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tomi Silander
    Replies:
    3
    Views:
    904
    Grant Edwards
    Apr 6, 2005
  2. I.M. Postor
    Replies:
    2
    Views:
    597
    I.M. Postor
    Sep 27, 2006
  3. MisterWilliam
    Replies:
    1
    Views:
    316
    George Sakkis
    Jun 18, 2008
  4. Peter Otten
    Replies:
    1
    Views:
    482
    rantingrick
    Feb 1, 2011
  5. Gnarlodious
    Replies:
    9
    Views:
    1,867
    Gnarlodious
    May 16, 2011
Loading...

Share This Page