xsl-list
[Top] [All Lists]

[xsl] flattening and re-ordering nested notes

2008-08-18 06:21:59
I have a book in a TEI-influenced flavor of XML. It contains many footnotes, which may themselves contain additional footnotes. These footnotes are coded inline in the originating text, directly following their reference:

/publication/chapter/section/div/
        <p>Some text here and here<ref type="footnote" target="someid">*</ref>
                <note type="footnote" id="someid">
                        <label id="lsomelabelid">* </label>
<p>Some note text<ref type="footnote" target="anotherid">&#x2020;</ ref>
                                <note type="footnote" id="anotherid">
                                        <label id="anotherlabel">&#x2020; 
</label>
                                        <p>A sub note for further reference</p>
                                </note>
                                goes here and here and here.
                        </p>
                </note>
                . And even more regular text here.
        </p>

Side note: I am already using a multi-stage transform on this XML to convert it to XHTML, so if I need to add another stage, that's just fine.

What I would like to do is un-nest the notes, such that my output XML would look more like this:

/publication/chapter/section/
        div
        div
        div
        note
        note
        note
        note*
        note*

(where asterisks denote formerly nested sub-notes)

Each note would then contain all of its text, refs, and any other content, but no child notes.

Further complicating this process is the fact that the publication/ chapter/section part of this program cannot be guaranteed -- divs can live at any level below publication and don't require any sort of parent besides that.

Can anyone recommend a flexible way to extract these notes and make them all one level?

Thanks in advance,

Walter

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