[x3d-public] XSLT expert needed for X3dToJson.xslt

John Carlson yottzumm at gmail.com
Wed Jan 20 22:37:36 PST 2021


There's no need to read this. It is include for completeness. Here is 
the validation of the JSON files as produced by saxon9he.jar:

$ node x3dvalidate.js ~/X3DJSONLD/src/main/data/LOA*json
Loading schema
Parsing schema
Adding schema
Schema 3.0 added
Schema 3.0 compiled
Success reading 
/home/coderextreme/X3DJSONLD/src/main/data/LOA0ExampleSourceInVRML.json
Success reading 
/home/coderextreme/X3DJSONLD/src/main/data/LOA0ExampleSourceInVRML.new.json
Success reading 
/home/coderextreme/X3DJSONLD/src/main/data/LOA0ExampleSourceWithDiamonds.json
Success reading 
/home/coderextreme/X3DJSONLD/src/main/data/LOA0ExampleSourceWithDiamonds.new.json
Success reading 
/home/coderextreme/X3DJSONLD/src/main/data/LOA1ExampleSourceInVRML.json
Success reading 
/home/coderextreme/X3DJSONLD/src/main/data/LOA1ExampleSourceInVRML.new.json
Success reading 
/home/coderextreme/X3DJSONLD/src/main/data/LOA1ExampleSourceWithDiamonds.json
Success reading 
/home/coderextreme/X3DJSONLD/src/main/data/LOA1ExampleSourceWithDiamonds.new.json
Success reading 
/home/coderextreme/X3DJSONLD/src/main/data/LOA2ExampleSourceInVRML.json
Loading schema
Parsing schema
Adding schema
Schema 4.0 added
Schema 4.0 compiled
Success reading 
/home/coderextreme/X3DJSONLD/src/main/data/LOA2ExampleSourceInVRML.new.json
Success reading 
/home/coderextreme/X3DJSONLD/src/main/data/LOA2ExampleSourceWithDiamonds.json
Success reading 
/home/coderextreme/X3DJSONLD/src/main/data/LOA2ExampleSourceWithDiamonds.new.json
Success reading 
/home/coderextreme/X3DJSONLD/src/main/data/LOA3ExampleSourceInVRML.json
Success reading 
/home/coderextreme/X3DJSONLD/src/main/data/LOA3ExampleSourceInVRML.new.json
Success reading 
/home/coderextreme/X3DJSONLD/src/main/data/LOA3ExampleSourceWithDiamonds.json
Success reading 
/home/coderextreme/X3DJSONLD/src/main/data/LOA3ExampleSourceWithDiamonds.new.json


On 1/21/21 12:34 AM, John Carlson wrote:
> Here are some of the errors produced by X3dToJson.xslt using xslt3 below.
>
> At this point, I'm not sure it if's xslt3 or X3dToJson.xslt.  I tested 
> with jsonlint, but probably jslint or jshint would produce useful output.
>
> Thanks for anyone who wants to improve JSON processing, potentially 
> leading to XML -> JSON processing working with HAnim 2 in the browser!
>
> To confirm my work, check out the files:
>
> https://github.com/coderextreme/X3DJSONLD/tree/master/src/main/data/LOA*.* 
>
>
> I think it would be good if we could work on all XSLT 2 and 3 processors.
>
> Output from saxon9he.jar appears OK.
>
> One could package up these files and report bugs to Saxonica, but 
> perhaps first we should confirm our stylesheets are right and portable 
> between Saxonica products.
>
> Since these examples don't pass jsonlint, I'm not even going to try 
> against schema.
>
> As far as the LOA*.x3d files (generated from .wrl using Michalis' 
> tool, I did not validate them yet.  That would be a good thing to do.  
> I am thinking that the X3D validator is potentially not up to date?
>
> Thanks,
>
> John
>
>  for i in LOA*json2; do echo $i; jsonlint $i; done
> LOA0ExampleSourceInVRML.new.json2
> Error: Parse error on line 126:
> ...deFieldNameNotFound":[
> -----------------------^
> Expecting 'EOF', '}', ',', ']', got ':'
>     at Object.parseError 
> (/usr/local/lib/node_modules/jsonlint/lib/jsonlint.js:55:11)
>     at Object.parse 
> (/usr/local/lib/node_modules/jsonlint/lib/jsonlint.js:132:22)
>     at parse (/usr/local/lib/node_modules/jsonlint/lib/cli.js:82:14)
>     at main (/usr/local/lib/node_modules/jsonlint/lib/cli.js:135:14)
>     at Object.<anonymous> 
> (/usr/local/lib/node_modules/jsonlint/lib/cli.js:179:1)
>     at Module._compile (internal/modules/cjs/loader.js:1138:30)
>     at Object.Module._extensions..js 
> (internal/modules/cjs/loader.js:1158:10)
>     at Module.load (internal/modules/cjs/loader.js:986:32)
>     at Function.Module._load (internal/modules/cjs/loader.js:879:14)
>     at Function.executeUserEntryPoint [as runMain] 
> (internal/modules/run_main.js:71:12)
> LOA0ExampleSourceWithDiamonds.new.json2
> Error: Parse error on line 126:
> ...deFieldNameNotFound":[
> -----------------------^
> Expecting 'EOF', '}', ',', ']', got ':'
>     at Object.parseError 
> (/usr/local/lib/node_modules/jsonlint/lib/jsonlint.js:55:11)
>     at Object.parse 
> (/usr/local/lib/node_modules/jsonlint/lib/jsonlint.js:132:22)
>     at parse (/usr/local/lib/node_modules/jsonlint/lib/cli.js:82:14)
>     at main (/usr/local/lib/node_modules/jsonlint/lib/cli.js:135:14)
>     at Object.<anonymous> 
> (/usr/local/lib/node_modules/jsonlint/lib/cli.js:179:1)
>     at Module._compile (internal/modules/cjs/loader.js:1138:30)
>     at Object.Module._extensions..js 
> (internal/modules/cjs/loader.js:1158:10)
>     at Module.load (internal/modules/cjs/loader.js:986:32)
>     at Function.Module._load (internal/modules/cjs/loader.js:879:14)
>     at Function.executeUserEntryPoint [as runMain] 
> (internal/modules/run_main.js:71:12)
> LOA1ExampleSourceInVRML.new.json2
> Error: Parse error on line 126:
> ...deFieldNameNotFound":[
> -----------------------^
> Expecting 'EOF', '}', ',', ']', got ':'
>     at Object.parseError 
> (/usr/local/lib/node_modules/jsonlint/lib/jsonlint.js:55:11)
>     at Object.parse 
> (/usr/local/lib/node_modules/jsonlint/lib/jsonlint.js:132:22)
>     at parse (/usr/local/lib/node_modules/jsonlint/lib/cli.js:82:14)
>     at main (/usr/local/lib/node_modules/jsonlint/lib/cli.js:135:14)
>     at Object.<anonymous> 
> (/usr/local/lib/node_modules/jsonlint/lib/cli.js:179:1)
>     at Module._compile (internal/modules/cjs/loader.js:1138:30)
>     at Object.Module._extensions..js 
> (internal/modules/cjs/loader.js:1158:10)
>     at Module.load (internal/modules/cjs/loader.js:986:32)
>     at Function.Module._load (internal/modules/cjs/loader.js:879:14)
>     at Function.executeUserEntryPoint [as runMain] 
> (internal/modules/run_main.js:71:12)
> LOA1ExampleSourceWithDiamonds.new.json2
> Error: Parse error on line 126:
> ...deFieldNameNotFound":[
> -----------------------^
> Expecting 'EOF', '}', ',', ']', got ':'
>     at Object.parseError 
> (/usr/local/lib/node_modules/jsonlint/lib/jsonlint.js:55:11)
>     at Object.parse 
> (/usr/local/lib/node_modules/jsonlint/lib/jsonlint.js:132:22)
>     at parse (/usr/local/lib/node_modules/jsonlint/lib/cli.js:82:14)
>     at main (/usr/local/lib/node_modules/jsonlint/lib/cli.js:135:14)
>     at Object.<anonymous> 
> (/usr/local/lib/node_modules/jsonlint/lib/cli.js:179:1)
>     at Module._compile (internal/modules/cjs/loader.js:1138:30)
>     at Object.Module._extensions..js 
> (internal/modules/cjs/loader.js:1158:10)
>     at Module.load (internal/modules/cjs/loader.js:986:32)
>     at Function.Module._load (internal/modules/cjs/loader.js:879:14)
>     at Function.executeUserEntryPoint [as runMain] 
> (internal/modules/run_main.js:71:12)
> LOA2ExampleSourceInVRML.new.json2
> Error: Parse error on line 126:
> ...deFieldNameNotFound":[
> -----------------------^
> Expecting 'EOF', '}', ',', ']', got ':'
>     at Object.parseError 
> (/usr/local/lib/node_modules/jsonlint/lib/jsonlint.js:55:11)
>     at Object.parse 
> (/usr/local/lib/node_modules/jsonlint/lib/jsonlint.js:132:22)
>     at parse (/usr/local/lib/node_modules/jsonlint/lib/cli.js:82:14)
>     at main (/usr/local/lib/node_modules/jsonlint/lib/cli.js:135:14)
>     at Object.<anonymous> 
> (/usr/local/lib/node_modules/jsonlint/lib/cli.js:179:1)
>     at Module._compile (internal/modules/cjs/loader.js:1138:30)
>     at Object.Module._extensions..js 
> (internal/modules/cjs/loader.js:1158:10)
>     at Module.load (internal/modules/cjs/loader.js:986:32)
>     at Function.Module._load (internal/modules/cjs/loader.js:879:14)
>     at Function.executeUserEntryPoint [as runMain] 
> (internal/modules/run_main.js:71:12)
> LOA2ExampleSourceWithDiamonds.new.json2
> Error: Parse error on line 126:
> ...deFieldNameNotFound":[
> -----------------------^
> Expecting 'EOF', '}', ',', ']', got ':'
>     at Object.parseError 
> (/usr/local/lib/node_modules/jsonlint/lib/jsonlint.js:55:11)
>     at Object.parse 
> (/usr/local/lib/node_modules/jsonlint/lib/jsonlint.js:132:22)
>     at parse (/usr/local/lib/node_modules/jsonlint/lib/cli.js:82:14)
>     at main (/usr/local/lib/node_modules/jsonlint/lib/cli.js:135:14)
>     at Object.<anonymous> 
> (/usr/local/lib/node_modules/jsonlint/lib/cli.js:179:1)
>     at Module._compile (internal/modules/cjs/loader.js:1138:30)
>     at Object.Module._extensions..js 
> (internal/modules/cjs/loader.js:1158:10)
>     at Module.load (internal/modules/cjs/loader.js:986:32)
>     at Function.Module._load (internal/modules/cjs/loader.js:879:14)
>     at Function.executeUserEntryPoint [as runMain] 
> (internal/modules/run_main.js:71:12)
> LOA3ExampleSourceInVRML.new.json2
> Error: Parse error on line 126:
> ...deFieldNameNotFound":[
> -----------------------^
> Expecting 'EOF', '}', ',', ']', got ':'
>     at Object.parseError 
> (/usr/local/lib/node_modules/jsonlint/lib/jsonlint.js:55:11)
>     at Object.parse 
> (/usr/local/lib/node_modules/jsonlint/lib/jsonlint.js:132:22)
>     at parse (/usr/local/lib/node_modules/jsonlint/lib/cli.js:82:14)
>     at main (/usr/local/lib/node_modules/jsonlint/lib/cli.js:135:14)
>     at Object.<anonymous> 
> (/usr/local/lib/node_modules/jsonlint/lib/cli.js:179:1)
>     at Module._compile (internal/modules/cjs/loader.js:1138:30)
>     at Object.Module._extensions..js 
> (internal/modules/cjs/loader.js:1158:10)
>     at Module.load (internal/modules/cjs/loader.js:986:32)
>     at Function.Module._load (internal/modules/cjs/loader.js:879:14)
>     at Function.executeUserEntryPoint [as runMain] 
> (internal/modules/run_main.js:71:12)
> LOA3ExampleSourceWithDiamonds.new.json2
> Error: Parse error on line 126:
> ...deFieldNameNotFound":[
> -----------------------^
> Expecting 'EOF', '}', ',', ']', got ':'
>     at Object.parseError 
> (/usr/local/lib/node_modules/jsonlint/lib/jsonlint.js:55:11)
>     at Object.parse 
> (/usr/local/lib/node_modules/jsonlint/lib/jsonlint.js:132:22)
>     at parse (/usr/local/lib/node_modules/jsonlint/lib/cli.js:82:14)
>     at main (/usr/local/lib/node_modules/jsonlint/lib/cli.js:135:14)
>     at Object.<anonymous> 
> (/usr/local/lib/node_modules/jsonlint/lib/cli.js:179:1)
>     at Module._compile (internal/modules/cjs/loader.js:1138:30)
>     at Object.Module._extensions..js 
> (internal/modules/cjs/loader.js:1158:10)
>     at Module.load (internal/modules/cjs/loader.js:986:32)
>     at Function.Module._load (internal/modules/cjs/loader.js:879:14)
>     at Function.executeUserEntryPoint [as runMain] 
> (internal/modules/run_main.js:71:12)
>
>
> On 1/20/21 11:37 PM, John Carlson wrote:
>> Here's an example run of xslt3
>>
>> $ node_modules/.bin/xslt3 
>> -xsl:/c/x3d-code/www.web3d.org/x3d/stylesheets/X3dToJson.xslt 
>> -s:bubs3.x3d -o:bubs3.json
>>
>>
>> I believe you can also install xslt3 for all users with:
>>
>> $ npm install -g xslt3,
>>
>> But check the Saxon-JS docs.  Or I can give you a package.json to 
>> create the node_modules folder.
>>
>>
>> Don has already addressed conversions like this.   Apparently, there 
>> are different results using saxon9he.jar and xslt3.
>>
>> We need to document this, and either address Don's stylesheet, or 
>> file a bug report.  The JSON output in many cases is not valid X3D JSON.
>>
>> One problem is that xslt3 is too slow to add to a build in many cases.
>>
>> I recently added this to my build, but the number of different 
>> results between the two stylesheet processors is overwhelming, so I'm 
>> hoping for someone with a bit of time on their hands to deal with this.
>>
>> If you're interested, feel free to contact me, and we can work on 
>> this privately, instead of spamming the list yet again. I think Don 
>> is busy.
>>
>> I think the first thing we can try is replacing saxon9he.jar in Don's 
>> builds.
>>
>> However, Don has suggested that he doesn't want to use node.js, so 
>> I'm kind of in a puzzle.
>>
>> Thanks,
>>
>> John
>>



More information about the x3d-public mailing list