Recent Notes
Displaying keyword search results 81 - 90
Created by nogeek on November 04, 2010 23:25:57
Last update: November 04, 2010 23:26:59
With this XML file:
<?xml version="1.0" encoding="ISO-8859-1"?>
<ev...
and this XSL:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xs...
The output of XSLT is:
A test event
Timestamp: 12886515008...
You may not want the title string in the output. There are two ways to do this:
Limit the apply-templates action with a select attribute:
<xsl:template match="/">
<xsl:apply-templat...
Suppress default text node output with an empty template:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xs...
Reference: http://www.dpawson.co.uk/xsl/sect2/defaultrule.html
Created by nogeek on November 04, 2010 20:08:02
Last update: November 04, 2010 20:45:25
Use the <xsl:with-param> and <xsl:param> tags to apply parameters to XSL stylesheets:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xs...
Created by nogeek on November 04, 2010 20:24:32
Last update: November 04, 2010 20:24:55
XSLT by default writes namespace declarations in the output. Most of the time it's spurious, sometimes outright wrong.
Take this XML:
<?xml version="1.0" encoding="ISO-8859-1"?>
<ev...
And this XSL:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xs...
where DateUtil.java is:
import java.util.Date;
public class DateUti...
The output is (with JDK1.6):
Title: <br xmlns:java="http://xml.apache.org/x...
The namespace declaration went to the <br> element, not the timestamp where it belongs.
To remove the namespace info, add exclude-result-prefixes to the XSL:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xs...
Created by James on October 26, 2010 21:43:52
Last update: October 26, 2010 21:44:37
Use the unbind method to unbind an event. The following example unbinds three events: mouseenter , mouseleave and click .
$('#control')
.find('a')
.css('cursor', 'def...
Created by James on October 25, 2010 04:45:59
Last update: October 25, 2010 04:45:59
The test method for JavaScript regular expression tests if a string matches the regular expression. Below are some examples:
/son/i.test('Jack Jake Jason'); // true
/ja/.te...
Created by Dr. Xi on October 20, 2010 15:53:47
Last update: October 20, 2010 15:54:32
I got this exception while doing scp with Ant:
build.xml:52: com.jcraft.jsch.JSchException: rejec...
The solution is to add trust="true" to the scp task:
<scp file="${dist.dir}/${war.file}"
todir...
Created by James on October 13, 2010 18:16:08
Last update: October 13, 2010 18:16:08
From jQuery doc :
The .data() method allows us to attach data of any type to DOM elements in a way that is safe from circular references and therefore from memory leaks.
We can set several distinct values for a single element and retrieve them later:
$('body').data('foo', 52);
$('body').data('bar'...
It must be emphasized that the data is associated with the DOM object, not the jQuery object:
var a = $('div label');
var b = $('div label');...
The above usage is just a shorthand for jQuery.data(domElement, key) .
Created by James on October 12, 2010 16:17:05
Last update: October 12, 2010 16:18:31
The splice method cuts elements from an array, and returns the cut-off elements as a new array.
a = [1, 2, 3, 4, 5, 6, 7];
b = a.splice(1, ...
Created by James on October 12, 2010 15:48:29
Last update: October 12, 2010 15:48:29
The pop method removes an element from the end of an array; the shift method removes an element from the beginning of an array:
a = [1, 2, 3, 4];
a.pop(); // 4
a.shift(); /...
Created by Dr. Xi on September 11, 2008 23:06:18
Last update: October 06, 2010 03:16:13
Firefox and Google chrome has native support for the trim function for a String. IE (as of IE 8.0) does not provide a trim function for String. Using the JavaScript Executor , if you execute:
'abcd '.trim
you get:
function trim() { [native code] }
in Firefox and Google Chrome. But you get nothing in IE. If you try to execute the trim method on a String:
'abcd '.trim()
you get this in IE:
TypeError: Object doesn't support this property or...
In order to have the trim function across all browsers, define this function:
if(typeof String.prototype.trim !== 'function') {
...
Or, if you use jQuery, you can use $.trim()