You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Preserve whitespace in empty <xsl:text> nodes #748
However, if <xsl:text> nodes do not contain text content, even preserve mode treats them as empty nodes and collapses them — but the whitespace here is significant in some cases.
For example, this syntax might be used in a stylesheet to define a newline character:
After this change, the newline character would be lost.
In other cases, a single space within <xsl:text> nodes may be used when constructing sequences of HTML class attribute values, or similar constructs. Without the space, values would be concatenated to a single keyword, instead of separated with spaces:
I certainly expected it to be preserved in preserve mode, and wasn't surprised to see it ignored in ignore mode.
Since the whole point of the <xsl:text> element is to write parsable character data and literal text to the output tree, it might make sense to preserve it even in ignore mode.
I'm not sure if there are any circumstances where that would be outright wrong — apart from the potential confusion that might be caused by not actually ignoring something in ignore mode.
Activity
kddnewton commentedon Jan 5, 2024
@infotexture do you think we should preserve the space even in
ignoremode? It seems like maybe we should.infotexture commentedon Jan 6, 2024
@kddnewton 🤔 Not sure about that.
I certainly expected it to be preserved in
preservemode, and wasn't surprised to see it ignored inignoremode.Since the whole point of the
<xsl:text>element is to write parsable character data and literal text to the output tree, it might make sense to preserve it even inignoremode.I'm not sure if there are any circumstances where that would be outright wrong — apart from the potential confusion that might be caused by not actually ignoring something in
ignoremode.stefan-jung commentedon Mar 20, 2024
@infotexture, to create a newline char, you might want to better use instead of:
This
<variable>:Use line feed character code in $newline variable