A html/xml function modeled after substr for truncating text within textnodes while preserving markup.