<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style></head><body lang=EN-US link=blue vlink="#954F72"><div class=WordSection1><p class=MsoNormal><span style='color:#70AD47'>With Native Java stylesheet engine (extra \’s), running output JavaScript:<o:p></o:p></span></p><p class=MsoNormal><span style='color:#70AD47'><o:p> </o:p></span></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>test-nashorn:</p><p class=MsoNormal>    [javac] Compiling 2 source files to C:\x3d-code\www.web3d.org\x3d\stylesheets\java\classes</p><p class=MsoNormal>     [java] Script DEF=colorTypeConversionScript contains CDATA source-code text, copied as "#sourceText" using "strings" mode</p><p class=MsoNormal>     [java] Script DEF=MaterialModulatorScript contains CDATA source-code text, copied as "#sourceText" using "strings" mode</p><p class=MsoNormal>     [java] HelloWorldProgramOutput self-validation test results: success</p><p class=MsoNormal>     [java] Warning: toFileStylesheetConversion(X3dToJson.xslt) is overwriting prior file nashorn/examples/HelloWorldProgramOutput.json</p><p class=MsoNormal>     [java] Script DEF=colorTypeConversionScript contains CDATA source-code text, copied as "#sourceText" using "strings" mode</p><p class=MsoNormal>     [java] Script DEF=MaterialModulatorScript contains CDATA source-code text, copied as "#sourceText" using "strings" mode</p><p class=MsoNormal>     [java] HelloWorldProgramOutput self-validation test results: success</p><p class=MsoNormal>     [java] Warning: toFileX3D() is overwriting prior file nashorn/examples/HelloWorldProgramOutput.x3d</p><p class=MsoNormal>     [java] HelloWorldProgramOutput self-validation test results: success</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>BUILD FAILED</p><p class=MsoNormal>C:\x3d-code\www.web3d.org\x3d\stylesheets\build.xml:1594: javax.script.ScriptException: SyntaxError: nashorn/examples/HelloWorldProgramOutput.js.intermediate.js:333:96 Expected comma but found ident</p><p class=MsoNormal>                                      "@value":["escaped quotation marks example 1: He said, \\"Immel did it!\\""]</p><p class=MsoNormal>                                                                                                ^ in <eval> at line number 5</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span style='color:#70AD47'>With default stylesheet engine (extra newlines and extra \’s, so previous is preferable):<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>test-nashorn:</p><p class=MsoNormal>    [javac] Compiling 2 source files to C:\x3d-code\www.web3d.org\x3d\stylesheets\java\classes</p><p class=MsoNormal>     [java] Script DEF=colorTypeConversionScript contains CDATA source-code text, copied as "#sourceText" using "strings" mode</p><p class=MsoNormal>     [java] Script DEF=MaterialModulatorScript contains CDATA source-code text, copied as "#sourceText" using "strings" mode</p><p class=MsoNormal>     [java] HelloWorldProgramOutput self-validation test results: success</p><p class=MsoNormal>     [java] Warning: toFileStylesheetConversion(X3dToJson.xslt) is overwriting prior file nashorn/examples/HelloWorldProgramOutput.json</p><p class=MsoNormal>     [java] Script DEF=colorTypeConversionScript contains CDATA source-code text, copied as "#sourceText" using "strings" mode</p><p class=MsoNormal>     [java] Script DEF=MaterialModulatorScript contains CDATA source-code text, copied as "#sourceText" using "strings" mode</p><p class=MsoNormal>     [java] HelloWorldProgramOutput self-validation test results: success</p><p class=MsoNormal>     [java] Warning: toFileX3D() is overwriting prior file nashorn/examples/HelloWorldProgramOutput.x3d</p><p class=MsoNormal>     [java] HelloWorldProgramOutput self-validation test results: success</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>BUILD FAILED</p><p class=MsoNormal>C:\x3d-code\www.web3d.org\x3d\stylesheets\build.xml:1594: javax.script.ScriptException: SyntaxError: nashorn/examples/HelloWorldProgramOutput.js.intermediate.js:57:83 Missing close quote</p><p class=MsoNormal>"@content":"Example HelloWorldProgram creates an X3D model using the X3D Java Scene</p><p class=MsoNormal>                                                                                   ^ in <eval> at line number 5</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span style='color:#70AD47'>So how can we fix X3dToJson.xslt to produce proper JSON for these cases?  Note that JSON and XML output isn’t right either.  Note that original java, not generated Java produces correct results, so lets look at intermediate generated Java:<o:p></o:p></span></p><p class=MsoNormal><span style='color:#70AD47'><o:p> </o:p></span></p><p class=MsoNormal>            .addValue(new MetadataStringObject().setName("escapedQuotesTest1").setValue(new MFStringObject("\"escaped quotation marks example 1: He said, \\\"Immel did it!\\\"\"")))</p><p class=MsoNormal><span style='color:#70AD47'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:red'>Which is correct.  So how do we either modify intermediate Java or downstream code to produce proper JSON (and XML) without affecting results produced by original Java?<o:p></o:p></span></p><p class=MsoNormal><span style='color:red'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:#70AD47'>Thanks,<o:p></o:p></span></p><p class=MsoNormal><span style='color:#70AD47'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:#70AD47'>John<o:p></o:p></span></p><p class=MsoNormal><span style='color:#70AD47'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:#70AD47'>PS:  I will work on converting my SAXON processes over to Native Java, if that’s OK with you.  It looks like Saxon is not the way to go?<o:p></o:p></span></p></div></body></html>