title: Preserve tags in parameter passed from xsl to c# method
body: <p>I have a xml with html and custom tags in the text part, xml snippet given below -</p>
  
  <pre><code>&lt;Text&gt;
      &lt;English&gt;
          &lt;p&gt;Some text goes here with html tags like
          &lt;span class='classname'&gt;more text&lt;/span&gt; and
          custom tags &lt;CustomTag uid='value'&gt;and
          text&lt;/CustomTag&gt;&lt;/p&gt;
      &lt;/English&gt;
  &lt;/Text&gt;
  </code></pre>
  
  <p>Now, the problem is threefold -</p>
  
  <ol>
  <li>Retain html tags in Text:child</li>
  <li>Process custom tags Text::child</li>
  <li>Escape double quotes in output string</li>
  </ol>
  
  <p>The xsl snippet used is this -</p>
  
  <p>This is where the Text::child (English or other) is used</p>
  
  <pre><code>&lt;xsl:variable name='stepText'&gt;&lt;xsl:apply-templates select='Text/child::*[name() = $language]'/&gt;&lt;/xsl:variable&gt;
  &lt;!-- This is the problem statement --&gt;
  &lt;xsl:variable name='stepTextNew'&gt;&lt;xsl:copy-of select="cs:EscapeDoubleQuotes($stepText)"/&gt;&lt;/xsl:variable&gt;
  jQuery('#stepText').html("&lt;xsl:copy-of select='$stepTextNew'/&gt;");
  </code></pre>
  
  <p>Above snippet calls c# method EscapeDoubleQuotes in the xsl to escape double quotes from the string returned by apply-templates.</p>
  
  <p>This is for the custom tags within Text::child -</p>
  
  <pre><code>&lt;xsl:template match="CustomTag"&gt;
      &lt;xsl:element name="a"&gt;
          &lt;xsl:attribute name="href"&gt;javascript:doSomething(1, '&lt;xsl:value-of select="@uid"/&gt;');&lt;/xsl:attribute&gt;
          &lt;xsl:attribute name="onmouseover"&gt;javascript:onHover(1, '&lt;xsl:value-of select="@uid"/&gt;', true);&lt;/xsl:attribute&gt;
          &lt;xsl:attribute name="onmouseout"&gt;javascript:onLeave(1, '&lt;xsl:value-of select="@uid"/&gt;', false);&lt;/xsl:attribute&gt;
      &lt;/xsl:element&gt;
  &lt;/xsl:template&gt;
  </code></pre>
  
  <p>This is for the html tags within Text::child -</p>
  
  <pre><code>&lt;xsl:template match="p | span"&gt;
      &lt;xsl:copy&gt;
          &lt;xsl:copy-of select="@*"/&gt;
          &lt;xsl:apply-templates select="node()"/&gt;
      &lt;/xsl:copy&gt;
  &lt;/xsl:template&gt;
  </code></pre>
  
  <p>Now, the problem I am facing is that tags in the string passed to cs:EscapeDoubleQuotes are stripped off automatically. If I try to output stepText directly, it does contain the tags, but stepTextNew does not. I tried debugging into the c# method and saw that the tags are stripped off in the input parameter itself.</p>
  
  <p>It will be of great help if anyone can shed some light on this issue or provide any hint for a solution to the three issues above.</p>