Altova Mailing List Archives


[xsl] (Probably trivial) grouping problem

From: "Stefan Tilkov" <stefan.tilkov@--------->
To:
Date: 7/18/2003 11:50:00 PM
I can't for the life of me figure out how to solve a simple problem. I 
know that it is related to grouping, but my XSL (and XPath) knowlegde is 
not up to translating answers given to similar problems to my particular 
case. 

I have a couple of paragrahps, marked up this way:

<para title="title1">
        some text
</para>
<para>
        a para without a title
</para>
<para title="title2">
        more text
</para>
<para>
        yet another untitled para
</para> 

I want to turn them into this:

<section>
        <title>title1</title>
        <para>
                some text
        </para>
        <para>
                a para without a title
        </para>
</section>
<section>
        <title>title2</title>
        <para>
                more text
        </para>
        <para>
                yet another untitled para
        </para> 
</section>

That is, I want to create sections from paragraphs, turning the title into 
an element belonging to the section. My experiments with following-sibling 
and preceeding-sibling all had the problem that *all* paragraphs without a 
title were returned, and I somehow need to get access to only those before 
the next para with a title. 

Any help would be greatly appreciated.

Stefan

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

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.