Why Attribute Substitution Does Not Work In Template For Dynamic List

I used a SQL query to build a dynamic list in Oracle Apex to display a Bootstrap timeline.
SELECT NULL lvl,
       c005 label,
       c004 link,
       CASE MOD (ROWNUM, 2) WHEN 0 THEN 'yes' ELSE 'NO' END is_current,
       CASE MOD (ROWNUM, 4)
          WHEN 0 THEN 'fa-clock-o'
          WHEN 1 THEN 'fa-credit-card'
          WHEN 2 THEN 'fa-bomb'
          WHEN 3 THEN 'fa-bank'
       END
          image,
       NULL image_attrib,
       NULL image_alt_attribute,
       CASE MOD (ROWNUM, 4)
          WHEN 0 THEN 'danger'
          WHEN 1 THEN 'info'
          WHEN 2 THEN 'success'
          WHEN 3 THEN 'warning'
       END
          attribute4
  FROM mytable;
and attribute04 (#A04#) is used in the the following template to define the class name of div:
<li>
    <div class="timeline-badge #A04#"><i class="fa #IMAGE#"></i>
    </div>
    <div class="timeline-panel">
        <div class="timeline-heading">
            <h4 class="timeline-title">#TEXT#</h4>
            <p><small class="text-muted"><i class="fa #A01#"></i>#LINK#</small>
            </p>
        </div>
    </div>
</li>
However, #A04# was not replaced with one the values from my sql statement (danger,info,success and warning) in rendered html file.
 <div class="timeline-badge #A04#"><i class="fa fa-bank"></i>
    </div>
    <div class="timeline-panel">
        <div class="timeline-heading">
            <h4 class="timeline-title">22-MAR-07</h4>
            <p><small class="text-muted"><i class="fa 298"></i> IND Open</small>
            </p>
        </div>
    </div>
After troubleshooting I realized that it's not the column alias that fines which parameters you're trying to set, it's the order of the parameter in the query itself when the list query is parsed. After adding values for attributes 1, 2 and 3 to null in sql query everything works fine.
SELECT NULL lvl,
       c005 label,
       c004 target,
       CASE MOD (ROWNUM, 2) WHEN 0 THEN 'yes' ELSE 'NO' END is_current,
       CASE MOD (ROWNUM, 4)
          WHEN 0 THEN 'fa-clock-o'
          WHEN 1 THEN 'fa-credit-card'
          WHEN 2 THEN 'fa-bomb'
          WHEN 3 THEN 'fa-bank'
       END
          image,
       NULL image_attrib,
       NULL image_alt_attribute,
       NULL attribute1, <------added
       NULL attribute2, <------added
       NULL attribute3, <------added
       CASE MOD (ROWNUM, 4)
          WHEN 0 THEN 'danger'
          WHEN 1 THEN 'info'
          WHEN 2 THEN 'success'
          WHEN 3 THEN 'warning'
       END
          attribute4
  FROM mytable;
 

Datatable static image not found on the server

When you use ```datatables.min.css``` and ```datatables.min.js``` locally, instead of datatables CDN, you may have encountered that ```sort...