xsl-list
[Top] [All Lists]

[xsl] grabbing chunks of preceding-siblings between tables

2007-10-04 08:40:46
Hi List,

Thanks in advance for the help. I'm doing some pre-processing of a XML
Dump of tables. I'm trying to associate header information in the
table to the table itself. I'm having difficulty figuring out how to
do this.. Anyway, examples always seem to say it better (XSLT 2.0 is
fine):

XML

<?xml version="1.0"?>
<root>
        <title1>Title for Table 1</title1>
        <title2>sub-title for Table 1</title2>
        <caption>Caption for Table 1</caption>
        <para_norm>Any number of different paragraphs that belong with Table
1</para_norm>
        <table>
                <cell>Foo</cell>
                <cell>Bar</cell>
        </table>
        <title2>Table 2 only has subtitle</title2>
        <caption>Caption for Table 2</caption>
        <para_diff>Any number of different paragraphs that belong with Table
2</para_diff>
        <table>
                <cell>Foo</cell>
                <cell>Bar</cell>
        </table>
        <title1>Title for Table 3</title1>
        <title2>sub-title for Table 3</title2>
        <caption>Caption for Table 3</caption>
        <para_norm>Any number of different paragraphs that belong with Table
3</para_norm>
        <table>
                <cell>Foo</cell>
                <cell>Bar</cell>
        </table>
</root>

Desired XML Output:

<?xml version="1.0"?>
<root>
        <table>
                <title1>Title for Table 1</title1>
                <title2>sub-title for Table 1</title2>
                <caption>Caption for Table 1</caption>
                <para_norm>Any number of different paragraphs that belong with 
Table
1</para_norm>
                <cell>Foo</cell>
                <cell>Bar</cell>
        </table>
        <table>
                <title2>Table 2 only has subtitle</title2>
                <caption>Caption for Table 2</caption>
                <para_diff>Any number of different paragraphs that belong with 
Table
2</para_diff>
                <cell>Foo</cell>
                <cell>Bar</cell>
        </table>
        <table>
                <title1>Title for Table 3</title1>
                <title2>sub-title for Table 3</title2>
                <caption>Caption for Table 3</caption>
                <para_norm>Any number of different paragraphs that belong with 
Table
3</para_norm>
                <cell>Foo</cell>
                <cell>Bar</cell>
        </table>
</root>

I've tried a number of different things, but can't seem to translate
"Take all elements between <table> and add as child to following
<table>" into XSLT. Any help would be greatly appreciated.

Thanks,

Spencer

--~------------------------------------------------------------------
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>
--~--