title: Can't display text into paragraphs using XQuery and eXist-db
body: <p>I have to figure out how to display paragraphs that each word in the paragraph has its own hover function(comment).</p>
  <p><a href="https://i.stack.imgur.com/Dh2xH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Dh2xH.png" alt="enter image description here" /></a></p>
  <p>Here is how the page looks like right now. I want to display the left text in paragraphs as I have in the right text. the first one is the translation and the second one is the original text.
  The thing is that I need to have a hover function on the first text for every word. It is already done this is how it looks and it's working for each word:
  <a href="https://i.stack.imgur.com/o3Cve.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/o3Cve.jpg" alt="enter image description here" /></a></p>
  <p>so to explain it better we have paragraphs and every word in paragraphs has to have the hover function with some comments.
  The main task is to display the words in paragraphs and not like it is the first picture, but like this:
  <a href="https://i.stack.imgur.com/bV2m1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bV2m1.png" alt="enter image description here" /></a></p>
  <p>This is my code right now which displays text like it's in the first picture, so not in paragraphs but every word on a new line with hover function:</p>
  <pre><code>declare function letter:text_orig($node as node(), $model as map())
  {
      let $resource := collection('/db/apps/Tobi-oshki/data')
      let $xml_id := letter:text_people('/db/apps/Tobi-oshki/data')
      for $rs in $resource//tei:rs
      for $id in $xml_id
          return
              if (data($rs/@key) eq $id)
              then 
                  &lt;html&gt;
  
               &lt;div data-toggle=&quot;tooltip&quot; data-placement=&quot;top&quot; 
               title=&quot;{letter:text_lem(data($rs/@key))}&quot;&gt; {$rs}&lt;/div&gt;
  
                 &lt;/html&gt;
               else
                  &quot;&quot; };
  </code></pre>
  <p>the XML file looks like this:</p>
  <pre><code> &lt;div type=&quot;original&quot; xml:lang=&quot;ka&quot;&gt;
          
              &lt;pb f=&quot;1r&quot; n=&quot;1&quot; xml:id=&quot;pb-orig-1r-1&quot; facs=&quot;#zone-pb-1r-1&quot;/&gt;
              
              &lt;lb n=&quot;2&quot; xml:id=&quot;l-1&quot;/&gt;
              &lt;ab&gt;[7125.5]&lt;rs type=&quot;pers&quot; key=&quot;320&quot;&gt;ენემ&lt;supplied reason=&quot;lost&quot;&gt;ეს&lt;/supplied&gt;[7125.1]არისთა&lt;/rs&gt;,
              
                  &lt;rs type=&quot;pers&quot; key=&quot;1643&quot;&gt;მეფისა &lt;/rs&gt;
                  
                  &lt;rs type=&quot;pers&quot; key=&quot;251&quot;&gt;თეზბეთ&lt;/rs&gt;,
                 
                  &lt;rs type=&quot;pers&quot; key=&quot;243&quot;&gt;ზემო-კერძო&lt;/rs&gt;
                  
                  &lt;rs type=&quot;pers&quot; key=&quot;245&quot;&gt;ასერსა&lt;/rs&gt;.
              &lt;/ab&gt;
  </code></pre>
  <p>so ab tag is a paragraph and rs tag is a word.</p>
  <p>Do you have any idea how can I display paragraphs with each word having its hover function?</p>