In the process of trying to make a stylesheet to convert old LoC transcriptions of books that used a very-outdated SGML DTD for formatting, I've run into a roadblock at the following situation:
In the converted XML files, there are some lines of text like the following:
<p> Text on left <hsep></hsep> Text on right </p>
hsep essentially pushes the remaining text to be right-justified. Unfortunately, I don't know of any way to convert this to HTML by just converting tags, as HTML has nothing like hsep short of dubious CSS hacks. I think it would be more useful to be able to convert this to something like:
<p> Text on left <span class="right">Text on right</span> </p>
However, I'm not sure how to do this, as it would require that, in the <p>
element, I determine whether there's an <hsep>
and then create a tag surrounding the remaining text based on it being there, while also applying templates to any elements that might be there. I don't think cases where I have something like
<p> Text a <em> Text b <hsep></hsep> Text c </em> </p>
are common or even present, so I don't think that will pose a problem, but there may be situations like:
<p> <em> Text a Text b <hsep></hsep> Text c </em> </p>
I can think of complicated, horrible ways of doing this involving regexes, but I'm hoping there's a non-horrible way.