xsl-list
[Top] [All Lists]

[xsl] following-sibling::

2009-02-06 20:00:18
First time poster in need of assistance =)

Using XSLT 1.0, given the following structure:

<document>
        <aaa />
        <aaa />
        <aaa />
        <aaa />
        <aaa stylename='start' />
        <aaa />
        <aaa />
        <aaa />
        <aaa />
        <aaa stylename='finish' />
        <aaa />
        <aaa />
        <aaa />
        <aaa />
        <aaa />
        <aaa stylename='start' />
        <aaa />
        <aaa />
        <aaa stylename='finish' />
        <aaa />
        <aaa />
</document>

How can I make the <aaa /> elements that exist in between @='start' and @='finish become children of <aaa stylename='start' />?

I've tried some sibling recursion techniques and such but I can't get my XPath right. I can select all the following-siblings of @='start' until the end of the document, but I need to select all of the following-siblings of @='start' until I reach @='finish'.

I've been using <xsl:copy-of select="following- sibling::*[(_at_)stylename='finish']" /> but this selection isn't stopping when I reach the first 'finish'. It's just selecting all the 'finish' in the document.


Desired output:

<document>
        <aaa />
        <aaa />
        <aaa />
        <aaa />
        <aaa stylename='start'>
                <aaa />
                <aaa />
                <aaa />
                <aaa />
        </aaa>
        <aaa />
        <aaa />
        <aaa />
        <aaa />
        <aaa />
        <aaa stylename='start' />
                <aaa />
                <aaa />
        </aaa>
        <aaa />
        <aaa />
</document>

In addition to this selection issue, "copy-of" is simply copying the elements to the result tree without applying templates. How can I 'copy' these elements and then apply-templates?


Thanks,
Myles Pflum




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>