Tip: I extracted the core part of the space explanation in "Xslt From Beginner to Mastery" to attract attention. I hope everyone will actively participate in the discussion. Talk about your understanding of spaces.
It is only suitable for scholars who have a certain understanding of the structure of xml file, but not for beginners. Please read from top to bottom.
For html files, spaces are not important; however, for xml, the default position is to keep space nodes (see below for explanation of space nodes).
According to the provisions of the xml specification, the so-called space is an arbitrary combination sequence of four characters:
-----------------------
Space character (space), corresponding character value is #x20
Return character (Carriage Return), corresponding character value is #xD
Newline characters, corresponding character value is #xA
The corresponding character value is #x9.
The spaces in the xml file will also form nodes, that is, space nodes. Space nodes belong to the text node type.
For xml and xslt, space nodes involve two issues:
-----------------------
1. It is important to decide which spaces are in the xml input file, and the xslt processor needs to see these space nodes. The key that is determined is the xml:space attribute.
2. It is important to decide which spaces are important in the xsl template file, the xslt processor should copy it to the result tree, and the key to determine is xsl:strip-space
and xsl:preserve-space.
"Important and unimportant space nodes"
-----------------------
If the content of a certain component can only be placed in the component, the space nodes in the component are not important (Insignificant);
If the content of a component is of type #PCDATA, the space nodes inside it should be considered important (Signficant).
As for the situation where the component content is mixed with text content and components, there is no way to judge it, and it should depend on the meaning of the component and its content.
The xslt processor will analyze it first before it comes into contact with the xml input file.
-----------------------
(1) The xml:space attribute can change the mode of processing space nodes by subsequent xml applications. For example, the xslt processor will be affected by the xml:space attribute.
(2) The ending symbols at the end of any column mark or content in the xml file will be replaced with a single new line character (#xA).
(3) Before the attribute value is handed over to the xml application, the xml analyzer should also normalize the attribute value first. This is because the ending characters of each line of text column in different operating systems have different combinations. For example, the Windows system will consist of the ending symbols of the return character and the new line character, while the Unix system will only consist of the new line character group.
To be a final symbol. After reading the xml file, the xml analyzer first replaced all ending symbols with a single new line character, which not only unified the differences in the design of different ending symbols between different systems, but also simplified the operation difficulty of subsequent xml applications. Such a processing process is called "Normalization".
a. The ending symbol of each text column must be normalized into a single new line character (#xA).
b. Any space character (#x20, #xD, #xA, #x9) should be replaced with a space character (#x20).
c. If the attribute value contains word parameter code, it should be replaced with the reference character. For example, 
 will be replaced with a new line character (#xA).
d. If the attribute value contains an entity reference, it should be replaced by its substitute text.
e. In addition, any character should be placed directly into the normalized attribute value.
f. Finally, if the attribute type is not CDATA, the xml analyzer should further delete the sequence of space characters before and after the attribute value, and if there is a sequence of spaces in the attribute value, it should also be replaced with a single space character.
After the xslt processor builds the structure tree of the xml input file and the xsl template file, it will now merge the adjacent text nodes in the component into a single text node, and then remove some text nodes. However, if the text node meets one of the following conditions, it will be retained:
-----------------------
(1) The parent component of a text node is a member of the space reserved component name set (Set Of Whitespace-preserving Element Names).
(2) There is at least one non-space character in the text node.
(3) There is an xml:space attribute in a certain ancestor component of a literal node, whose value is preserve, and there is no other xml:space attribute value in the relatively recent ancestor component is default. Other text nodes will be removed.
For xsl templates, the so-called space reserved component name set has only one xsl:text component available. The space nodes in the xsl template file will be deleted, but if the space node appears in the xsl:text component, it will be retained.
It is only suitable for scholars who have a certain understanding of the structure of xml file, but not for beginners. Please read from top to bottom.
For html files, spaces are not important; however, for xml, the default position is to keep space nodes (see below for explanation of space nodes).
According to the provisions of the xml specification, the so-called space is an arbitrary combination sequence of four characters:
-----------------------
Space character (space), corresponding character value is #x20
Return character (Carriage Return), corresponding character value is #xD
Newline characters, corresponding character value is #xA
The corresponding character value is #x9.
The spaces in the xml file will also form nodes, that is, space nodes. Space nodes belong to the text node type.
For xml and xslt, space nodes involve two issues:
-----------------------
1. It is important to decide which spaces are in the xml input file, and the xslt processor needs to see these space nodes. The key that is determined is the xml:space attribute.
2. It is important to decide which spaces are important in the xsl template file, the xslt processor should copy it to the result tree, and the key to determine is xsl:strip-space
and xsl:preserve-space.
"Important and unimportant space nodes"
-----------------------
If the content of a certain component can only be placed in the component, the space nodes in the component are not important (Insignificant);
If the content of a component is of type #PCDATA, the space nodes inside it should be considered important (Signficant).
As for the situation where the component content is mixed with text content and components, there is no way to judge it, and it should depend on the meaning of the component and its content.
The xslt processor will analyze it first before it comes into contact with the xml input file.
-----------------------
(1) The xml:space attribute can change the mode of processing space nodes by subsequent xml applications. For example, the xslt processor will be affected by the xml:space attribute.
(2) The ending symbols at the end of any column mark or content in the xml file will be replaced with a single new line character (#xA).
(3) Before the attribute value is handed over to the xml application, the xml analyzer should also normalize the attribute value first. This is because the ending characters of each line of text column in different operating systems have different combinations. For example, the Windows system will consist of the ending symbols of the return character and the new line character, while the Unix system will only consist of the new line character group.
To be a final symbol. After reading the xml file, the xml analyzer first replaced all ending symbols with a single new line character, which not only unified the differences in the design of different ending symbols between different systems, but also simplified the operation difficulty of subsequent xml applications. Such a processing process is called "Normalization".
a. The ending symbol of each text column must be normalized into a single new line character (#xA).
b. Any space character (#x20, #xD, #xA, #x9) should be replaced with a space character (#x20).
c. If the attribute value contains word parameter code, it should be replaced with the reference character. For example, 
 will be replaced with a new line character (#xA).
d. If the attribute value contains an entity reference, it should be replaced by its substitute text.
e. In addition, any character should be placed directly into the normalized attribute value.
f. Finally, if the attribute type is not CDATA, the xml analyzer should further delete the sequence of space characters before and after the attribute value, and if there is a sequence of spaces in the attribute value, it should also be replaced with a single space character.
After the xslt processor builds the structure tree of the xml input file and the xsl template file, it will now merge the adjacent text nodes in the component into a single text node, and then remove some text nodes. However, if the text node meets one of the following conditions, it will be retained:
-----------------------
(1) The parent component of a text node is a member of the space reserved component name set (Set Of Whitespace-preserving Element Names).
(2) There is at least one non-space character in the text node.
(3) There is an xml:space attribute in a certain ancestor component of a literal node, whose value is preserve, and there is no other xml:space attribute value in the relatively recent ancestor component is default. Other text nodes will be removed.
For xsl templates, the so-called space reserved component name set has only one xsl:text component available. The space nodes in the xsl template file will be deleted, but if the space node appears in the xsl:text component, it will be retained.