DesignLiquido / xslt-processor

A JavaScript XSLT processor without native library dependencies
GNU Lesser General Public License v3.0
95 stars 30 forks source link

local-name() #32

Closed JonathanRowell closed 1 year ago

JonathanRowell commented 4 years ago

One could do with local-name(), useful when dynamically creating elements and it should be simple to implement as it follows on from 'name'. `` 'local-name' (ctx) { assert(this.args.length == 1 || this.args.length == 0); let n; if (this.args.length == 0) { n = [ctx.node]; } else { n = this.args[0].evaluate(ctx).nodeSetValue(); }

    if (n.length == 0) {
        return new StringValue('');
    } else {
        let name = n[0].nodeName;
        if(name.contains':') {
            return new StringValue(name.slice(name.indexOf(':')+1));
        } else {
            return new StringValue(name);
        }
    }
},

`

JonathanRowell commented 4 years ago

Sorry I got the code insert wrong!

berenddeboer commented 4 years ago

Ah, missed this, I just implemented this in #36.

But in general this package doesn't handle namespaces.

josiahwitheford commented 1 year ago

Hey there, is there any chance this feature is going to be released soon?

leonelsanchesdasilva commented 1 year ago

Hi @josiahwitheford. This was released on https://github.com/DesignLiquido/xslt-processor/releases/tag/v1.0.0. Please let me know if any adjustments are required.

leonelsanchesdasilva commented 1 year ago

For now I'm closing this, but should return in the future if any problems arise from this implementation.