If you use the following input:
<root>\"
<!--  -->
<!--  -->

	
</root>
and run the following:
java -cp lib/saxon/saxon9.jar net.sf.saxon.Transform t.xml conf/xml-to-json.xsl
You'll get:
{
"root": [
"\\\"\n",
{
"": null
},
{
"": null
}
]
}
where as if you move the comments to after the character entities, you'll get:
"root": [
"\\\"\n\r\n\t\n",
{
"": null
},
{
"": null
}
]
}
With the CR and HT both properly in the output.
If you use the following input:
and run the following:
You'll get:
where as if you move the comments to after the character entities, you'll get:
With the CR and HT both properly in the output.