Convert HTML entities
use HTML::Entities; ... $html = encode_entities($string, '<>&"');
DZone Snippets > beutelevision > html
12098 users tagging and storing useful source code snippets
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Thomas Beutel http://www.beutelevision.com
use HTML::Entities; ... $html = encode_entities($string, '<>&"');
<xsl:template match="my_repeating_item"> <tr> <xsl:if test="position() mod 2 != 1"> <xsl:attribute name="style">background-color:#dddddd</xsl:attribute> </xsl:if> <xsl:apply-templates/> </tr> <xsl:template>
#!/usr/bin/perl use HTML::FromText; use strict; my $text = join '',<>; my $html = text2html($text, urls => 1, email => 1, bold=>1, paras => 1, allcaps => 1, tables => 1, bullets => 1, underline=>1); print $html;
C-x ESC-1 ESC-| tohtml RET
function listToXml(){ var vList = document.getElementById('phonetic'); var vLen = vList.childNodes.length; var vXml = "<ul>"; for(var i = 0; i < vLen - 1; i++){ if(vList.childNodes[i].innerHTML){ vXml = vXml + '<li>' + vList.childNodes[i].innerHTML + '</li>'; } } vXml = vXml + '</ul>'; document.myform.listfield.value = vXml; } ... <ul id="phonetic" class="sortable boxy" style="margin-left: 1em;"> <li>alpha</li> <li>bravo</li> <li>charlie</li> <li>delta</li> <li>echo</li> <li>foxtrot</li> </ul> <form name="myform"> <input type="text" name="listfield" value="" size="60"> <input type="button" value="submit2" name="submit2" onClick="listToXml()"> </form>