xsl-list
[Top] [All Lists]

[xsl] Re: Including markup in a replace string

2016-10-06 23:40:17
Hi Craig,


I think we should use "disable-output-escaping="yes"" here.


Below is the code for expected output.


<xsl:value-of select="replace($pattern,'(\{\{|\}\})','&lt;span 
class=&quot;noProcess&quot;&gt;$1&lt;/span&gt;')" 
disable-output-escaping="yes"/>



Regards,

Vishnu

________________________________
From: Craig Sampson craig(_dot_)sampson(_at_)sas(_dot_)com 
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com>
Sent: Thursday, October 6, 2016 6:40 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Including markup in a replace string


Hi All,

  I have code examples in some doc that are post processed in AngularJS. In 
some cases the code examples include "{{" or "}}" which is significant to 
Angular. I have a simple replace that I am using to wrap a no-process span 
around the curly braces so the Angular process will ignore them.



  <xsl:value-of select="replace(.,'(\{\{|\}\})','&lt;span 
class=&quot;noProcess&quot;&gt;$1&lt;/span&gt;')"/>



  The only problem is that the character entity is being output as a character 
entity instead of less-than and greater-than characters.



  Is there a way to trick replace into outputting the less-than and 
greater-than characters?



  I've tried entering the actual characters - doesn't work. I've tried escaping 
the characters with backslashes - doesn't work either.



  So unless there's a way to trick replace I'll have to try analyze-string and 
see if I can get what I need there.



Thanks,

  Craig



Here's an example of what I need:



<span class="noProcess">{{</span>This variable<span class="noProcess">}}</span>





XSL-List info and archive<http://www.mulberrytech.com/xsl/xsl-list>
EasyUnsubscribe<-list/778978> (by email<>)
"This e-mail and any attachments transmitted with it are for the sole use of 
the intended recipient(s) and may contain confidential , proprietary or 
privileged information. If you are not the intended recipient, please contact 
the sender by reply e-mail and destroy all copies of the original message. Any 
unauthorized review, use, disclosure, dissemination, forwarding, printing or 
copying of this e-mail or any action taken in reliance on this e-mail is 
strictly prohibited and may be unlawful."
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--
<Prev in Thread] Current Thread [Next in Thread>