次の方法で共有


Overriding <xsl:preserve-space> and <xsl:strip-space> (Windows Embedded CE 6.0)

1/6/2010

Use the xml:space attribute to override the effect of <xsl:strip-space> or <xsl:preserve-space>. When applied to a white-space-only <xsl:text> node within an element otherwise marked to have its spaces stripped or preserved, xml:space indicates whether the white space content contained within the <xsl:text> element should be preserved. For example, even though the <block> elements in the preceding example were specified in the <xsl:strip-space> element list, you can force the preservation of four spaces by including the following in that template rule.

<block><xsl:text xml:space="yes">     </xsl:text></block>

This example is artificial, in that it forces the insertion of white space within the style sheet. It does not restore or preserve white space in the original document. To do that, you must override the default stripping of extraneous white space by setting the preserveWhiteSpace property to TRUE at the time the document is loaded into the Document Object Model (DOM).

See Also

Concepts

Controlling White Space with XSLT
Preserving and Stripping White Space
Handling White Space
Controlling White Space with the DOM