Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: [xsl] Problem with Positional Grouping from MSXML

From: "Mukul Gandhi" <gandhi.mukul@--------->
To:
Date: 2/1/2007 4:01:00 PM
I have described few techniques for Positional Grouping at my web site:



http://gandhimukul.tripod.com/xslt/grouping.html#positionalgrouping.
(if this link doesn't work, please go to
http://gandhimukul.tripod.com/xslt/grouping.html, item no 33)

I hope this helps you to solve the problem..



On 2/1/07, Andy Carr1 <CARRA@xxxxxxxxxx> wrote:

Hi



I am running into difficulties while trying to perform Positional Grouping
on a MSXML file.
What I need to do is find the Headings in a MSXML file and transform them
into <Section> tags. Everything beneath the Heading should become a child
of <Section> until the next Heading is found, at which point the process
starts over.

A sample of the xml I am trying to transform is:



<ns0:Body>
  <w:p>
     <w:pPr>
        <w:pStyle w:val="BodyHeading"/>
     </w:pPr>
     <w:r>
        <w:t>Heading Text</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>Another Heading Text</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>

Sorry it's a bit long. As you can see MSXML treats a Heading as <w:p> like
any other paragraph. The output desired should look like this:

<Body>
  <Section>
     <Title>Heading Text</Title> (from the first Heading)
     <List>
        <ListItem>Some list text</List>
     </List>
     <Para>Some text</Para>
  </Section>
  <Section>
     <Title>Another Heading Text</Title> (from the second Heading)
     <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 might contain
and I think I need to use the w:pStyle/@w:val attribute to identify which
paragraphs need to become Section headings but I can't get the right logic.

I am using XSL 2.0 with XMLSpy">XMLSpy 2007- I would appreciate some help as my
head is about to explode :-/

Regards
Andy

Andy Carr
IT Specialist
Tel: Internal - 298037 External - 01252 558037
Mail Point  M1C IBM Application Services
Meudon House, Meudon Avenue, Farnborough, GU14 7NB
(Notes) Andy Carr1/UK/IBM@IBMGB
(Internet)CARRA@xxxxxxxxxx




--
Regards,
Mukul Gandhi


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent