开发者

How do I stop the XSLT from putting a line break between my TEXTAREA tags

开发者 https://www.devze.com 2023-03-07 16:40 出处:网络
I have in an xsl file a transform that contains <TEXTAREA></TEXTAREA> (no spaces) and when it is transformed the results are

I have in an xsl file a transform that contains <TEXTAREA></TEXTAREA> (no spaces) and when it is transformed the results are

<TEXTAREA>
</开发者_开发问答TEXTAREA>

I can't find the right properties to stop this from happening.

We are using XslCompiledTransform and XmlTextWriter

Thank you.


XmlTextWriter has a Formatting property that by default is set to Formatting.None. Check that this is the case - if this property were set to Formatting.Indent it would account for the unwanted line-feed.


Use the xsl:strip-space element at the beginning of the styleheet.

<xsl:strip-space elements='TEXTAREA'>


Unwanted whitespace in the output generally comes from one of three places: it's copied from the source document (often by implicitly applying the built-in template rules to whitespace text nodes in the source); or it's generated by using indent="yes", or (rarely, but worth looking for because it's the last place most people think of) it's copied from the stylesheet because someone put xml:space="preserve" in the stylesheet source.

0

精彩评论

暂无评论...
验证码 换一张
取 消