[oXygen-user] Whitespace-only text nodes in XSLT
Syd Bauman
Thu Jun 25 14:38:32 CDT 2015
If it makes you feel any better, Wendell, I get the same output when
I run this on itself in saxon[1] from the commandline. I get the
expected whitespace node if I add
<xsl:output method="xml" indent="yes"/>
Notes
-----
[1] Saxon-HE 9.6.0.2J
> 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,
More information about the oXygen-user
mailing list