RE: [xsl] flattening and re-ordering nested notes

Subject: RE: [xsl] flattening and re-ordering nested notes
From: "Houghton,Andrew" <houghtoa@xxxxxxxx>
Date: Mon, 18 Aug 2008 09:28:07 -0400
> From: Walter Lee Davis [mailto:waltd@xxxxxxxxxxxx]
> Sent: Monday, August 18, 2008 9:21 AM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] flattening and re-ordering nested notes
>
> 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>
>
> 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*
>
> 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.

How about after you output the div sections you do something like:

<xsl:for-each select="/publication//note">
  <!-- output note -->
</xsl:for-each>


Andy.

Current Thread