Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Positional Grouping

Reply
Thread Tools

Positional Grouping

 
 
Andy
Guest
Posts: n/a
 
      01-10-2007
Hi
I'm having difficulties with positional grouping.
I have a wordML fragment that looks something like this:

<ns0:Body>
<w>
<wPr>
<wStyle w:val="BodyHeading"/>
</wPr>
<w:r>
<w:t>Subject Matter</w:t>
</w:r>
</w>
<w>
<wPr>
<wStyle w:val="NumberedText"/>
</wPr>
<w:r>
<w:t>Some list text</w:t>
</w:r>
</w>
<w>
<wPr>
<wStyle w:val="Text"/>
</wPr>
<w:r>
<w:t>Some text</w:t>
</w:r>
</w>
<w>
<wPr>
<wStyle w:val="BodyHeading"/>
</wPr>
<w:r>
<w:t>Subject Matter 2</w:t>
</w:r>
</w>
<w>
<wPr>
<wStyle w:val="Text"/>
</wPr>
<w:r>
<w:t>Some more text</w:t>
</w:r>
</w>
<w>
<wPr>
<wStyle w:val="NumberedText"/>
</wPr>
<w:r>
<w:t>Some more list text</w:t>
</w:r>
</w>
</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 wStyle 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.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
argparse: combine current option value with positional argument Peter Otten Python 1 02-01-2011 04:23 PM
extra positional arguments before optional parameters syntax MisterWilliam Python 1 06-18-2008 09:34 PM
XSLT embedding (positional grouping key?) problem. newbie I.M. Postor XML 2 09-27-2006 08:03 AM
optparse and negative numbers as positional arguments Tomi Silander Python 3 04-06-2005 02:42 PM
DVD Verdict reviews: LAST EXILE: POSITIONAL PLAY (VOLUME 2) and more! DVD Verdict DVD Video 0 04-29-2004 09:05 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57