# How to use normalize-space operation in String Function Using XPath in Xml

• 3465

Introduction

normalize-space operation/function is a part of string function in XPath. This function takes a string argument and returns the argument string with the leading, trailing, and repeating white spaces stripped, that means after apply the normalize-space the text become normalized with no line breaks, and give a proper sentence. If the argument is not present then this function takes the current node and normalize it.

Syntax

 string normalize-space(string)

Hear normalize-space is a function that takes a string type argument and give the normalize way of this argument.

Example

The following example shows how we use the normalize-space function,

Code for normalize.xml

   Hey    Hi,   How   are   you   !!!!!!   Today   In this article   I explain the   normalize function   which is   used  to normalize    the text   ,remove white   spaces

Code for normal.xslt

         Unnormalized:

""     Normalized: ""

Output

When applied to the XML file (normalize.xml), the XSLT style sheet above produces the following output:

Unormalized:

"

Hey    Hi,

How   are   you

!!!!!!

I explain the   normalize function

which is   used  to normalize    the text

,remove white

spaces

"

Normalized:

"Hey Hi, How are you !!!!!! Today In this article I explain the normalize function which is used to normalize the text ,remove white spaces"
{"ft_lang_label":"__label__en","ft_lang_prob":0.6321787,"math_prob":0.7819836,"size":1979,"snap":"2020-34-2020-40","text_gpt3_token_len":455,"char_repetition_ratio":0.18329114,"word_repetition_ratio":0.2267658,"special_character_ratio":0.23395655,"punctuation_ratio":0.17142858,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.95869786,"pos_list":[0,1,2],"im_url_duplicate_count":[null,null,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-08-12T06:28:07Z\",\"WARC-Record-ID\":\"<urn:uuid:14f3c98e-8130-4a47-a4c6-b87d1cf3c9c0>\",\"Content-Length\":\"76581\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:edde6a83-d9a4-483e-a322-fc89024149f2>\",\"WARC-Concurrent-To\":\"<urn:uuid:89a5e8c1-d18e-4bba-8429-95854e1a6fe6>\",\"WARC-IP-Address\":\"172.67.145.26\",\"WARC-Target-URI\":\"https://www.dotnetheaven.com/article/how-to-use-normalize-space-operation-in-string-function-usin\",\"WARC-Payload-Digest\":\"sha1:HAVFITIVPBSUBW6KTYFFDBGNLRW7732B\",\"WARC-Block-Digest\":\"sha1:D77426TPCZIRDMIXMDROMGNSE3DHLDOO\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-34/CC-MAIN-2020-34_segments_1596439738878.11_warc_CC-MAIN-20200812053726-20200812083726-00299.warc.gz\"}"}