I have the following xpath that I need to run, but Jquery doesn't support the functions....so how can i actually make this work in jquery ?
$("//*[br]/text()[string-length(normalize-space()) != 0]").each( ....
Um - modern jQuery doesn't support XPath. jQuery isn't an Xpath parsing utility.
However, I would recommend you actually translate that into jQuery... perhaps something like
$('*[br]').filter(function() {
var text = $(this).text(), normalized = $.trim( text );
return normalized.length>0
});
Though you may need an additional regex replacement of multiple whitespace, I'm not quite sure how that xsl/xpath function works.
br. Let me know if you actually meant something else instead.John Resig (the author of jQuery) wrote an Xpath Plugin.
Please check the new compatibility Plugin for JQuery:
http://docs.jquery.com/Release:jQuery_1.2#XPath_Compatibility_Plugin
But keep one thing in mind: "XPath is a language to traverse nodes in XML document during the transformation (look for XSLT)." :-)