Please help me X-perts! I've got input XML documents that have a <body> XML tag enclosing "structured" text. E.g.:
<?xml version=1.0"?>
<d:Doc xmlns:d="urn:foo:bar">
<d:Body>
TITLE: An engaging topic with little to
no op-ed-ness (yes the title text wraps...)
PUBLICATION DATE: 24 March 2014
PUBLISHER: The Internet
AUTHOR: Jane Doe, Guy Smiley, Napoleon Dynamite
TEXT: Bacon ipsum dolor amet ut jerky flank, in
aliqua kielbasa et meatball officia ea minim
t-bone quis beef. Commodo pancetta chicken
meatloaf consequat, eu tempor nisi et brisket
occaecat aliquip shankle ut pork chop. Reprehenderit
anim voluptate irure.
</d:Body>
</d:Doc>
...and I need to transform stuff like the above into something like this:
<?xml version="1.0"?>
<d:Doc xmlns:d="urn:foo:bar">
<d:Body>
<d:Pre qualifier="TITLE">TITLE: An engaging topic with little to
no op-ed-ness (yes the title text wraps...)</d:Pre>
<d:Pre qualifier="DATE">DATE: 24 March 2014</d:Pre>
<d:Pre qualfier="PUBLISHER">PUBLISHER: The Internet</d:Pre>
<d:Pre qualifier="AUTHOR">AUTHOR: Jane Doe, Guy Smiley, Napoleon Dynamite</d:Pre>
<d:Pre qualifer="TEXT">TEXT: Bacon ipsum dolor amet ut jerky flank, in
aliqua kielbasa et meatball officia ea minim
t-bone quis beef. Commodo pancetta chicken
meatloaf consequat, eu tempor nisi et brisket
occaecat aliquip shankle ut pork chop. Reprehenderit
anim voluptate irure.</d:Pre>
</d:Body>
</d:Doc>
I'm trying to do this with an XSLT 2.0 stylesheet. The good news is the leading tokens (TITLE, DATE, AUTHOR, etc) are a controlled vocabulary; the bad news is the text following those tokens may or may not wrap onto one or more subsequent lines. Of course the XML that's produced must honor any namespaces in the original.
Any suggestions?