title: How to generate markup inside of <xsl:attribute> text?
body: <p>My XSLT stylesheet generates <a href="http://getbootstrap.com/" rel="nofollow noreferrer">Bootstrap</a> HTML where some elements may contain <code>data-...</code> attributes to pass additional data to the framework. For example, I have this code to generate a <a href="http://getbootstrap.com/javascript/#popovers" rel="nofollow noreferrer">popover</a> element:</p>
  
  <pre><code>&lt;xsl:template match="foo"&gt;
    &lt;a href="#" data-toggle="popover" data-placement="top" data-trigger="hover" data-html="true"&gt;
      &lt;xsl:attribute name="title"&gt;Popover Title&lt;/xsl:attribute&gt;
      &lt;xsl:attribute name="data-content"&gt;This is some additional content.&lt;/xsl:attribute&gt;
      &lt;xsl:text&gt;Link&lt;/xsl:text&gt;
    &lt;/a&gt;
  &lt;/xsl:template&gt;
  </code></pre>
  
  <p>The <code>data-content</code> attribute is supposed to contain additional markup. The resulting output should be something like</p>
  
  <pre><code>&lt;a href="#" ... data-content="This is &lt;em&gt;some&lt;/em&gt; additional &lt;a href='#'&gt;content&lt;/a&gt;."&gt;Link&lt;/a&gt;
  </code></pre>
  
  <p>How do I generate markup text for the <code>&lt;xsl:attribute&gt;</code> in this case?</p>
  
  <p>(Somewhat related: <a href="https://stackoverflow.com/questions/13202762/html-inside-twitter-bootstrap-popover">here</a> and <a href="https://stackoverflow.com/questions/8494291/can-i-use-html-tags-in-twitter-bootstrap-popover-data-content">here</a> and <a href="https://stackoverflow.com/questions/8875376/is-it-possible-to-use-a-div-as-content-for-twitters-popover">here</a>.)</p>
  
  <p><strong>The answers</strong></p>
  
  <p>Thanks for the answers! While I think that <a href="https://stackoverflow.com/questions/28398651/how-to-generate-markup-inside-of-xslattribute-text#28399342">kjhughes's answer</a> provides the technically correct solution to implement properly what I need, I think that <a href="https://stackoverflow.com/questions/28398651/how-to-generate-markup-inside-of-xslattribute-text#28399742">Ian's answer</a> addresses my question more directly.</p>