title: HOW TO force XSLT to encode apostrophes as it does for quotes
body: <p>in input XML I have a tag</p>
  
  <pre><code>&lt;name&gt;Sample " '&lt;/name&gt;
  </code></pre>
  
  <p>in XSL I transform this tag with: </p>
  
  <pre><code>&lt;xsl:variable name="productName" select="substring($elemXPath/name,1,50)"/&gt;
  &lt;someTag someAttr="{$productName}"/&gt;
  </code></pre>
  
  <p>When I run XSLT the output is:</p>
  
  <pre><code>&lt;someTag someAttr="Sample &amp;quot; '"/&gt;
  </code></pre>
  
  <p>but I'd like to get</p>
  
  <pre><code>&lt;someTag someAttr="Sample &amp;quot; &amp;apos;"/&gt;
  </code></pre>
  
  <p>instead. I don't want to wrap every use of input data with separate escaping template because there is a waste number of such a places in my xslt.</p>
  
  <p>I tried to encode apostrophes in the input file but when I put</p>
  
  <pre><code>&lt;name&gt;Sample &amp;apos;&lt;/name&gt;
  </code></pre>
  
  <p>to the input file then I got</p>
  
  <pre><code>&lt;someTag someAttr="Sample &amp;amp;apos;"/&gt;
  </code></pre>
  
  <p>instead of</p>
  
  <pre><code>&lt;someTag someAttr="Sample &amp;apos;"/&gt;
  </code></pre>
  
  <p><strong>My question is how to force/configure XSLT to encode apostrophes as it does for quotes?</strong></p>