
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_^

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,

Hey Syd, On Thu, Jun 25, 2015 at 3:38 PM, Syd Bauman <syd@paramedic.wwp.neu.edu> wrote:
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"/>
Yes, I suspect that Saxon or its parser is stripping the node for some reason. Thanks for helping to confirm it's not an oXygen thing. The indent='yes' whitespace isn't actually the same ... it is inserted by the serializer. and for one reason and another, isn't really workable for me. (In the actual problem I am generating HTML output, and in mixed content in the result, no extra whitespace is inserted even with indent='yes'.) I checked the Saxon -strip:none flag, which seems like it's supposed to prevent this (though I have no DTD); I wonder what's up with it. Cheers, Wendell
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,
oXygen-user mailing list oXygen-user@oxygenxml.com http://www.oxygenxml.com/mailman/listinfo/oxygen-user
-- Wendell Piez | http://www.wendellpiez.com XML | XSLT | electronic publishing Eat Your Vegetables _____oo_________o_o___ooooo____ooooooo_^

Hi Wendell, I think that is removed by step 3 in http://www.w3.org/TR/xslt20/#stylesheet-stripping Best Regards, George -- George Cristian Bina <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger http://www.oxygenxml.com On 25/06/15 23:44, Wendell Piez wrote:
Hey Syd,
On Thu, Jun 25, 2015 at 3:38 PM, Syd Bauman <syd@paramedic.wwp.neu.edu> wrote:
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"/>
Yes, I suspect that Saxon or its parser is stripping the node for some reason. Thanks for helping to confirm it's not an oXygen thing.
The indent='yes' whitespace isn't actually the same ... it is inserted by the serializer. and for one reason and another, isn't really workable for me. (In the actual problem I am generating HTML output, and in mixed content in the result, no extra whitespace is inserted even with indent='yes'.)
I checked the Saxon -strip:none flag, which seems like it's supposed to prevent this (though I have no DTD); I wonder what's up with it.
Cheers, Wendell
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,
oXygen-user mailing list oXygen-user@oxygenxml.com http://www.oxygenxml.com/mailman/listinfo/oxygen-user

On 26.6.2015 5:49, George Bina wrote:
I think that is removed by step 3 in http://www.w3.org/TR/xslt20/#stylesheet-stripping
Exactly. One has to keep in mind that rules for whitespace stripping are different for input XML documents and for XSLT stylesheets. Usually this works in an intuitive way, but once XML data are put inside XSLT stylesheet it can produce unexpected behaviour. In Wendell's case, easy fix would be using xml:space="preserve": <xsl:variable name="mixed" as="element()"> <mixed xml:space="preserve">Here is mixed content, including <one>children</one> <two>with nothing</two> but whitespace between them.</mixed> </xsl:variable> Also please note that xml:space can't be put on xsl:variable in this case as text node before <mixed> would break type annotation. Jirka -- ------------------------------------------------------------------ Jirka Kosek e-mail: jirka@kosek.cz http://xmlguru.cz ------------------------------------------------------------------ Professional XML and Web consulting and training services DocBook/DITA customization, custom XSLT/XSL-FO document processing ------------------------------------------------------------------ OASIS DocBook TC member, W3C Invited Expert, ISO JTC1/SC34 rep. ------------------------------------------------------------------ Bringing you XML Prague conference http://xmlprague.cz ------------------------------------------------------------------

Dear Jirka and George, You guys are absolute correct - and I even knew that - unfortunately as it happens the real-life bug is in processing a separate file ... I thought I'd duplicated it but I guess I was actually demonstrating a "feature". :-> Thanks anyhow (I will look back at the offending stylesheet) -- Cheers, Wendell On Fri, Jun 26, 2015 at 2:41 AM, Jirka Kosek <jirka@kosek.cz> wrote:
On 26.6.2015 5:49, George Bina wrote:
I think that is removed by step 3 in http://www.w3.org/TR/xslt20/#stylesheet-stripping
Exactly. One has to keep in mind that rules for whitespace stripping are different for input XML documents and for XSLT stylesheets. Usually this works in an intuitive way, but once XML data are put inside XSLT stylesheet it can produce unexpected behaviour.
In Wendell's case, easy fix would be using xml:space="preserve":
<xsl:variable name="mixed" as="element()"> <mixed xml:space="preserve">Here is mixed content, including
<one>children</one> <two>with nothing</two>
but whitespace between them.</mixed> </xsl:variable>
Also please note that xml:space can't be put on xsl:variable in this case as text node before <mixed> would break type annotation.
Jirka
-- ------------------------------------------------------------------ Jirka Kosek e-mail: jirka@kosek.cz http://xmlguru.cz ------------------------------------------------------------------ Professional XML and Web consulting and training services DocBook/DITA customization, custom XSLT/XSL-FO document processing ------------------------------------------------------------------ OASIS DocBook TC member, W3C Invited Expert, ISO JTC1/SC34 rep. ------------------------------------------------------------------ Bringing you XML Prague conference http://xmlprague.cz ------------------------------------------------------------------
-- Wendell Piez | http://www.wendellpiez.com XML | XSLT | electronic publishing Eat Your Vegetables _____oo_________o_o___ooooo____ooooooo_^

Hi again -- Indeed the problem was related to an xsl:import, which I hadn't traced sufficiently carefully -- sorry for the noise, and the distraction! Cheers, Wendell On Mon, Jun 29, 2015 at 10:51 AM, Wendell Piez <wapiez@wendellpiez.com> wrote:
Dear Jirka and George,
You guys are absolute correct - and I even knew that - unfortunately as it happens the real-life bug is in processing a separate file ... I thought I'd duplicated it but I guess I was actually demonstrating a "feature". :->
Thanks anyhow (I will look back at the offending stylesheet) --
Cheers, Wendell
On Fri, Jun 26, 2015 at 2:41 AM, Jirka Kosek <jirka@kosek.cz> wrote:
On 26.6.2015 5:49, George Bina wrote:
I think that is removed by step 3 in http://www.w3.org/TR/xslt20/#stylesheet-stripping
Exactly. One has to keep in mind that rules for whitespace stripping are different for input XML documents and for XSLT stylesheets. Usually this works in an intuitive way, but once XML data are put inside XSLT stylesheet it can produce unexpected behaviour.
In Wendell's case, easy fix would be using xml:space="preserve":
<xsl:variable name="mixed" as="element()"> <mixed xml:space="preserve">Here is mixed content, including
<one>children</one> <two>with nothing</two>
but whitespace between them.</mixed> </xsl:variable>
Also please note that xml:space can't be put on xsl:variable in this case as text node before <mixed> would break type annotation.
Jirka
-- ------------------------------------------------------------------ Jirka Kosek e-mail: jirka@kosek.cz http://xmlguru.cz ------------------------------------------------------------------ Professional XML and Web consulting and training services DocBook/DITA customization, custom XSLT/XSL-FO document processing ------------------------------------------------------------------ OASIS DocBook TC member, W3C Invited Expert, ISO JTC1/SC34 rep. ------------------------------------------------------------------ Bringing you XML Prague conference http://xmlprague.cz ------------------------------------------------------------------
-- Wendell Piez | http://www.wendellpiez.com XML | XSLT | electronic publishing Eat Your Vegetables _____oo_________o_o___ooooo____ooooooo_^
-- Wendell Piez | http://www.wendellpiez.com XML | XSLT | electronic publishing Eat Your Vegetables _____oo_________o_o___ooooo____ooooooo_^
participants (4)
-
George Bina
-
Jirka Kosek
-
Syd Bauman
-
Wendell Piez