[oXygen-user] Whitespace-only text nodes in XSLT
Wendell Piez
Thu Jun 25 14:20:56 CDT 2015
Hi,
Given this stylesheet:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs"
version="2.0">
<xsl:variable name="mixed" as="element()">
<mixed>Here is mixed content, including
<one>children</one>
<two>with nothing</two>
but whitespace between them.</mixed>
</xsl:variable>
<xsl:template match="/">
<xsl:apply-templates select="$mixed"/>
</xsl:template>
<xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="node() | @*"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
I run it on itself in oXygen, and get
<?xml version="1.0" encoding="UTF-8"?><mixed>Here is mixed content, including
<one>children</one><two>with nothing</two>
but whitespace between them.</mixed>
I would expect whitespace between the </one><two>.
What am I missing? Have things changed wrt whitespace-handling rules?
(As I see it, the temporary tree $mixed should contain a
whitespace-only text node between the 'one' and 'two' elements.)
Thanks for any insights,
Wendell
--
Wendell Piez | http://www.wendellpiez.com
XML | XSLT | electronic publishing
Eat Your Vegetables
_____oo_________o_o___ooooo____ooooooo_^
More information about the oXygen-user
mailing list