Git Product home page Git Product logo

xslt4node's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xslt4node's Issues

Processing very large XML file leaks gigabytes of memory

Hi
I am trying to process a very large (1.8GB) XML file, with an XSLT to JSON style sheet.
The process works fine with up to 5K records, however when I try to feed the full file with ~180K records - the system runs out of memory (even when I specify -Xmx=4096m)

I have split the XML file into 5K record chunks using an excellent https://github.com/remuslazar/node-xmlsplit package. Now I am able to process all 35 (or so) chunks one time - great!
However at the end of the transformation my node.js process would be sitting at around 4 GB in memory size. When I try the transformation again (it's supposed to be a daily process) - it will run out of memory.

So my question is - is there a way to release all memory resources after I am done with my XSLT processing?

Right now I am using a pretty ugly workaround - calling process.exit() and PM2 restarts my program. However I would like to see if there is a more civilized approach.

fatal link error on windows 10

LINK : fatal error LNK1181: cannot open input file " ■/.obj" [C:\Work\SqnfmIniToWebConfig\node_modules
java\build\nodejavabridge_bindings.vcxproj]

only parser xsl:include, header and footer not return ?

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:template match="/a">
		<header>Header</header>
	</xsl:template>

	<xsl:include href="./src/template/a/a.xsl" />
	<xsl:template match="/b">
		<footer>Footer</footer>
	</xsl:template>
</xsl:stylesheet>

Segmentation fault: 11

code in my own node.js module (copied it from 1 of your tests as a starting point):

var ORDER = '<order><book ISBN="10-861003-324"><title>The Handmaid\'s Tale</title><price>19.95</price></book><cd ISBN="2-3631-4"><title>Americana</title><price>16.95</price></cd></order>';
var DISCOUNT = '<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:param name="discount"/><xsl:template match="/"><order><xsl:variable name="sub-total" select="sum(//price)"/><total><xsl:value-of select="$sub-total"/></total>15% discount if paid by: <xsl:value-of select="$discount"/></order></xsl:template></xsl:stylesheet>';
var RESULT = '<?xml version="1.0" encoding="UTF-8"?><order><total>36.9</total>15% discount if paid by: 1972/01/01</order>';

var config = {
    xslt: DISCOUNT,
    source: ORDER,
    result: String,
    params: {
        discount: '1972/01/01'
    }
};
xslt4node.transform(config, function (err, result) {
    if (!err) {
        console.log(">>RESULT:");
        console.log(result);
    }else{
        console.log(">>ERROR:");
        console.log(err);
    }
});

On execution of this code I will get in the console:

Segmentation fault: 11

And the node app stops running. No line with >>ERROR: either so it didn't go into callback. Memory access violation issue?
OSX 10.9.5
Java 1.8.0_45
Python 2.7.5

First run error

The first time I call transform it returns the following error:

[Error: Index: 0, Size: 0]

Subsequent calls are successful... something blocking on initialisation? It seems to only happen when I call transforms with either params or props set in the config which makes me suspect its something todo with the addTask function

function addTask(taskName, tasks, props, setter) {
    tasks[taskName] = ['transformer', function (callback, results) {
        async.forEach(Object.keys(props), function (p, callback) {
            results.transformer[setter](p, props[p], callback);
        }, callback);
    }];
    tasks.transform.unshift(taskName);
}

you can repeat it with the following test:

var xslt = require('xslt4node');
var transform = xslt.transform;

var ORDER = '<order><book ISBN="10-861003-324"><title>The Handmaid\'s Tale</title><price>19.95</price></book><cd ISBN="2-3631-4"><title>Americana</title><price>16.95</price></cd></order>';

var DISCOUNT = '<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:param name="discount"/><xsl:template match="/"><order><xsl:variable name="sub-total" select="sum(//price)"/><total><xsl:value-of select="$sub-total"/></total>15% discount if paid by: <xsl:value-of select="$discount"/></order></xsl:template></xsl:stylesheet>';

var config = {
    xslt: DISCOUNT,
    source: ORDER,
    result: String,
    params : {
        hmmmm: 'laaa',
        laaa: 'jaaa',
        blaa: 'kaaa',
        hmmm: 'daaa'
    },
};

transform(config, function(err, res) {
        if (err) {
                console.log(err);
        } else {
                console.log(res);
        }
});

Can't install xslt4node on my mac running High Sierra

I have managed to install it on an old mac running Yosemite but when I deploy my app to heroku it fails when tries to install xslt4node.

The first error I get is when the following command is issued:

node-gyp rebuild

Any clues
TIA
jcr

providing {function}String as the argument for result

Hi, sorry if this is a noobish question, but i'm tying to get the result as the 2nd parameter of the transform() callback. I'm unsure what is meant by 'provide {function} String as argument for config.result property'. Again, i'm a noob so I apologize...

a quick code example would clear this up for me and teach me for the future.

Thanks

Mac OSX Java Version

Is there a specific Java version need to run this on OSX 10.10?

Ran nodeunit test and was asked to install java, however I have 1.8.0_45-b14 installed.

$ nodeunit test/test.js

test.js
✔ configuration - ambiguous xslt
✔ configuration - ambiguous source
✔ configuration - source missing
✔ configuration - result missing
No Java runtime present, requesting install.
$ java -version
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)

async dependency - TypeError: null is not a function

Hi, here is how dependencies looks like in package.json file after I install xslt4node using npm:

"dependencies": { "java": ">=0.3.1", "async": ">=0.4.0" }

I am able to use transformSync() but having issues with transform(). On both Windows and Linux I'm getting TypeError: null is not a function message. Obviously there is a problem with a version of async dependency. When I edit this dependency in node_modules/xslt4node/package.json file to "async": "~=1.5.2" everything works fine.

I would be very grateful if you could fix this as I use this package a lot and it's bit frustrating to manually edit package.json each time I build an application.

Thank you!

xsl:include xslt bad path reference

First, thank you for this module. I very much need it to move from an IIS/ISAPI approach to node.js

In my current templates, I use the following successfully. With this transformer, I get an error that the included template can't be found and it's listed in the error as being relative to my node project folder (which is 2 folders higher than the original xslt and not referenced in this code anywhere).

<xsl:include href="RptHeader.xslt"/>

I've also tried:

<xsl:include href="./RptHeader.xslt"/>

The structure is:

/project
   /xml
      /xslt
          myTemplate.xslt (this includes "RptHeader.xslt")
          RptHeader.xslt

The error indicates that /project/RptHeader.xslt does not exist though. How do I fix this reference? My primary template shouldn't need a full path (and that would be a problem for our platform anyway as it's being migrated from another parser).

Can't npm install xslt4node on El Captain

I am having a hard time trying to npm install this package on my machine. This is the stack trace below:

npm i xslt4node

[email protected] install /projects/new-platform-prototype/node_modules/java
node-gyp rebuild

CXX(target) Release/obj.target/nodejavabridge_bindings/src/java.o
CXX(target) Release/obj.target/nodejavabridge_bindings/src/javaObject.o
CXX(target) Release/obj.target/nodejavabridge_bindings/src/javaScope.o
CXX(target) Release/obj.target/nodejavabridge_bindings/src/methodCallBaton.o
CXX(target) Release/obj.target/nodejavabridge_bindings/src/nodeJavaBridge.o
CXX(target) Release/obj.target/nodejavabridge_bindings/src/utils.o
SOLINK_MODULE(target) Release/nodejavabridge_bindings.node
ld: warning: directory not found for option '-L/Library/Java/JavaVirtualMachines/jdk-9.0.1.jdk/Contents/Home/jre/lib/server'

ld: library not found for -ljvm
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Release/nodejavabridge_bindings.node] Error 1
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack at emitTwo (events.js:125:13)
gyp ERR! stack at ChildProcess.emit (events.js:213:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Darwin 15.6.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /projects/new-platform-prototype/node_modules/java
gyp ERR! node -v v8.6.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN [email protected] requires a peer of webpack@1 || 2 || ^2.1.0-beta || ^2.2.0-rc but none is installed. You must install peer dependencies yourself.

What is -ljvm? I looked on Google and Stack Overflow but couldn't find anything.

I'm on El Captain, with Java 9.0.1 npm 5.0.6 and I have JDK installed correctly.

Would it be possible to set JVM options like maximum heap size, etc.

Would it be possible to add a function set java options like maximum heap size for JVM, etc ?

It looks like our transformation process is running out of heap memory when dealing with huge files.

node-java allows to set JVM parameters using something like

java.options.push('-Xmx1024m');

It would be great to have an API method similar to one that adds a particular XSLT library to classpath?

sync call

is it possible to run xslt4node.transform(config) synchronously?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.