Project

Profile

Help

Trying to convert SVG to JSON

Added by arniwarp Sklinb about 3 years ago

Hi,

 I want to convert an SVG file with [[https://github.com/JayDaley/XML-to-JSON-in-XSLT]] to JSON format.

 The SVG input, html and xsl files are as attached. Because xml-to-json.xsl requires an XSLT 2.0 processor,

 I need to use Saxon-CE; but there's an error in Chrome's console message:

 SaxonCE.XSLT20Processor 21: 20: 24.613 SEVERE: Exception java.lang.IllegalArgumentException in invokeTransform: non-integral


 Who could kindly help me with some hints?
svg2json-saxnct2.html (520 Bytes) svg2json-saxnct2.html
svgt2json.xsl (658 Bytes) svgt2json.xsl import xml-to-json.xsl
test_flyout.svg (20.8 KB) test_flyout.svg data input

Replies (2)

RE: Trying to convert SVG to JSON - Added by Michael Kay about 3 years ago

Very hard to tell from this, I'm afraid.

I would strongly suggest that you migrate from Saxon-CE to Saxon-JS, which we are in a much better position to support. Saxon-CE is a dead end.

Also, Saxon-JS supports XSLT 3.0 which has a lot of built-in support for JSON (so you might be able to use the custom XML-to-JSON conversion as an alternative to the stylesheets you are running - though it would still need tailoring to your specific needs).

RE: Trying to convert SVG to JSON - Added by arniwarp Sklinb about 3 years ago

Hello Kay,

I deeply appreciate your guidance and  instant response. 

I will try to use Saxon-JS for the transformation of JSON format.

XSLT 2.0 and XPath 2.0 4th Edition is a great reference book. 

Thanks a lot.  
    (1-2/2)

    Please register to reply