Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing XSLT to change surrounding data based on an empty tag
    primarykey
    data
    text
    <p>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:</p> <p>In the converted XML files, there are some lines of text like the following:</p> <p><code>&lt;p&gt; Text on left &lt;hsep&gt;&lt;/hsep&gt; Text on right &lt;/p&gt;</code></p> <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> <p><code>&lt;p&gt; Text on left &lt;span class="right"&gt;Text on right&lt;/span&gt; &lt;/p&gt;</code></p> <p>However, I'm not sure how to do this, as it would require that, in the <code>&lt;p&gt;</code> element, I determine whether there's an <code>&lt;hsep&gt;</code> 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> <p><code>&lt;p&gt; Text a &lt;em&gt; Text b &lt;hsep&gt;&lt;/hsep&gt; Text c &lt;/em&gt; &lt;/p&gt;</code></p> <p>are common or even present, so I don't think that will pose a problem, but there may be situations like:</p> <p><code>&lt;p&gt; &lt;em&gt; Text a Text b &lt;hsep&gt;&lt;/hsep&gt; Text c &lt;/em&gt; &lt;/p&gt;</code></p> <p>I can think of complicated, horrible ways of doing this involving regexes, but I'm hoping there's a non-horrible way.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload