How to preserve whitespace within an element's opening tag in XSLT

前端 未结 1 477
旧巷少年郎
旧巷少年郎 2021-01-21 23:15

In order to avoid committing sensitive information to an SCM repository, I wrote an XSL stylesheet that removes connection string passwords from ASP.NET Web.config

相关标签:
1条回答
  • 2021-01-22 00:00

    whitespace within tags is not significant and can be normalised by the processor to single spaces and you cannot control this in standard tools. Nor can you control the order of attributes or the characters used for quoting (quot vs apos). Character entities may also be converted to equivalent representations. It is possible that you can find custom serializers that will do want you want but not in XSLT.

    Note that the whitespace within element content can be partially preserved if required (but I don't think this was part of your requirement).

    See also: Preserving attribute whitespace

    And see the very extensive XSLT FAQ on whitespace: http://www.dpawson.co.uk/xsl/sect2/N8321.html

    0 讨论(0)
提交回复
热议问题