Cannot navigate through an XML using XSLT
<p>I am trying to navigate through an XML and create an HTML file using XSLT.</p>

<p>This is my sample:</p>

<pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;ns0:monitor&gt;
    &lt;ns0:messages&gt;
        &lt;ns0:message&gt;
            &lt;ns0:surrogate_key&gt;R2DYSJ&lt;/ns0:surrogate_key&gt;
            &lt;ns0:isFailed&gt;false&lt;/ns0:isFailed&gt;
            &lt;ns0:rollovers&gt;
                &lt;ns0:rollover&gt;
                    &lt;ns0:conversation_id&gt;Rollover.53789980697.18112016110321.48027&lt;/ns0:conversation_id&gt;
                    &lt;ns0:part_id&gt;5378998069748027&lt;/ns0:part_id&gt;
                    &lt;ns0:transaction_type&gt;INITIATE_OUT&lt;/ns0:transaction_type&gt;
                    &lt;ns0:transaction_status&gt;IRR_ACCEPTED_BY_GATEWAY&lt;/ns0:transaction_status&gt;
                    &lt;ns0:transferring_usi&gt;123213&lt;/ns0:transferring_usi&gt;
                    &lt;ns0:receiving_usi&gt;123213&lt;/ns0:receiving_usi&gt;
                    &lt;ns0:mmbr_family_name&gt;LG&lt;/ns0:mmbr_family_name&gt;
                    &lt;ns0:policy_number&gt;1005905885&lt;/ns0:policy_number&gt;
                    &lt;ns0:isFailed&gt;false&lt;/ns0:isFailed&gt;
                &lt;/ns0:rollover&gt;
            &lt;/ns0:rollovers&gt;
        &lt;/ns0:message&gt;
        &lt;ns0:message&gt;
            &lt;ns0:surrogate_key&gt;R2DYTX&lt;/ns0:surrogate_key&gt;
            &lt;ns0:isFailed&gt;false&lt;/ns0:isFailed&gt;
            &lt;ns0:rollovers&gt;
                &lt;ns0:rollover&gt;
                    &lt;ns0:conversation_id&gt;Rollover.53789980697.18112016110321.48027.ANZ&lt;/ns0:conversation_id&gt;
                    &lt;ns0:part_id&gt;5378998069748027&lt;/ns0:part_id&gt;
                    &lt;ns0:transaction_type&gt;INITIATE_IN&lt;/ns0:transaction_type&gt;
                    &lt;ns0:transaction_status&gt;POLICY_DETAILS_NOT_FOUND&lt;/ns0:transaction_status&gt;
                    &lt;ns0:transferring_usi&gt;123213&lt;/ns0:transferring_usi&gt;
                    &lt;ns0:receiving_usi&gt;123213&lt;/ns0:receiving_usi&gt;
                    &lt;ns0:mmbr_family_name&gt;LG&lt;/ns0:mmbr_family_name&gt;
                    &lt;ns0:isFailed&gt;false&lt;/ns0:isFailed&gt;
                &lt;/ns0:rollover&gt;
            &lt;/ns0:rollovers&gt;
        &lt;/ns0:message&gt;
    &lt;/ns0:messages&gt;
&lt;/ns0:monitor&gt;
</code></pre>

<p>My XSLT looks like this:</p>

<pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;xsl:stylesheet  version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions"&gt;
  &lt;xsl:output method="html"  version="1.0" encoding="UTF-8" indent="yes"/&gt;
  &lt;xsl:template  match="/"&gt; 
    &lt;html&gt;
      &lt;head&gt;
        &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;&lt;/meta&gt;
        &lt;link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" &gt;&lt;/link&gt;
        &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"&gt;&lt;/script&gt;
        &lt;script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"&gt;&lt;/script&gt;
      &lt;/head&gt;
      &lt;body&gt;
        &lt;div class="container"&gt;
          &lt;h2&gt;Rollovers Monitor&lt;/h2&gt;
          &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; This dashboard show data for only the last 3 days.&lt;/p&gt;
          &lt;div class="panel-group" id="accordion"&gt;
            &lt;xsl:for-each select="//monitor/messages/message"&gt;
              &lt;xsl:choose&gt;
                &lt;xsl:when test="isFailed = 'true'"&gt;
                  &lt;xsl:element name="div"&gt;
                    &lt;xsl:attribute name="class"&gt;
                      panel panel-danger
                    &lt;/xsl:attribute&gt;
                  &lt;/xsl:element&gt;
                &lt;/xsl:when&gt;
                &lt;xsl:otherwise&gt;
                  &lt;xsl:element name="div"&gt;
                    &lt;xsl:attribute name="class"&gt;
                      panel panel-default
                    &lt;/xsl:attribute&gt;
                  &lt;/xsl:element&gt;
                &lt;/xsl:otherwise&gt;
              &lt;/xsl:choose&gt;
              &lt;div class="panel-heading"&gt;
                &lt;h4 class="panel-title"&gt;&lt;a data-toggle="collapse" data-parent="#accordion" href="#{surrogate_key}"&gt;Surrogate Key {surrogate_key}&lt;/a&gt;&lt;/h4&gt;
              &lt;/div&gt;
</code></pre>

<p>and does more things after that. The result of this goes all the way to <code>&lt;div class="panel-group" id="accordion"&gt;</code> which essentially means I am hitting the xpath expression correctly.</p>

<p>Any ideas? Thanks</p>