Note that there are some explanatory texts on larger screens.

plurals
  1. POescaping html tags inside xslt:value-of select
    text
    copied!<p><br/> I am converting text inside a XML document element (<em>which also contains other texts not only a hyperlink</em>) to hyperlink using the following:<br/></p> <pre><code>&lt;xsl:value-of select="replace(AUTHOR_CONTACT_INFORMATION, '(abc@yahoo.com)', '&amp;lt;a href=&amp;quot;$1&amp;quot;&amp;gt;$1&amp;lt;/a&amp;gt;')"/&gt; </code></pre> <p>XML Source:</p> <pre><code>&lt;AUTHOR_CONTACT_INFORMATION&gt;Plugin author can be reached at abc@yahoo.com for his email.&lt;/AUTHOR_CONTACT_INFORMATION&gt; </code></pre> <p>Unfortunately, I cannot escape the '&lt;' &amp; '&gt;' tags used in a href. My XSLT processor is Qt4's QXmlQuery class. It seems it doesn't support 'disable-output-escaping' attribute in the above expression and I can't seem to find any other way than to manually parse the final output and replace each '&amp;lt' &amp; '&amp;gt' with '&lt;' &amp; '>' using C++ code.</p> <p>PS: Couldn't get 'analyse-string' to work in qt either. It just returns empty string. Refered to <a href="http://www.dpawson.co.uk/xsl/rev2/regex2.html" rel="nofollow">http://www.dpawson.co.uk/xsl/rev2/regex2.html</a> question 3 and used the following:</p> <pre><code>&lt;xsl:analyze-string select="AUTHOR_CONTACT_INFORMATION" regex="(abc@yahoo.com)"&gt; &lt;xsl:matching-substring&gt; &lt;a href="{.}"&gt;&lt;xsl:value-of select="." /&gt;&lt;/a&gt; &lt;/xsl:matching-substring&gt; &lt;xsl:non-matching-substring&gt; &lt;xsl:value-of select="." /&gt; &lt;/xsl:non-matching-substring&gt; &lt;/xsl:analyze-string&gt; </code></pre> <p>The above works fine in 'Altova XMLSpy' doing exactly what I want. But in Qt4, the output has empty string (To be more accurate my &lt;td&gt; tag before this expression is also mysteriously gone in the output, weird). Qt4 documentation says its processor supports 'xsl:analyze-string'. Any one have a working example of 'xsl:analyze-string' in Qt?</p> <p>Qt4 documentation says its processor doesn't support 'xsl:character-map' so no point going there.</p> <p>Without 'xsl:analyze-string' working I am back to square one with 'replace()'.</p> <p>-Sanjeev</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload