[xsl] Noobie: normalize <b><a>...</a></b> to <a><b>...</b></a>

Subject: [xsl] Noobie: normalize <b><a>...</a></b> to <a><b>...</b></a>
From: Kenneth Reid Beesley <krbeesley@xxxxxxxxx>
Date: Thu, 18 Feb 2010 10:54:34 -0700
I'm converting a non-XML data-dump into XML, and the document contains examples of both

<a><b>...</b></a>

and

<b><a>...</a></b>

which (in this document) are equivalent. I'd like to use XSLT to convert all examples of the latter to the former, with the following caveats:

1. <b> can contain mixed text, in which case nothing should be changed.
2. <b><a>...</a></b> should be changed to <a><b>...</b></a> only if the <a>...</a> element is the unique child node of <b>...</b>


How can I do this?

Thanks,

Ken

******************************
Kenneth R. Beesley, D.Phil.
P.O. Box 540475
North Salt Lake, UT
84054  USA

Current Thread