diff --git a/src/registerCustomXPathFunction.ts b/src/registerCustomXPathFunction.ts index 0427b88a9..2af56a6ad 100644 --- a/src/registerCustomXPathFunction.ts +++ b/src/registerCustomXPathFunction.ts @@ -82,9 +82,6 @@ export function adaptXPathValueToJavascriptValue( sequenceType.mult === SequenceMultiplicity.ONE_OR_MORE ) { return valueSequence.getAllValues().map((value) => { - if (isSubtypeOf(value.type, ValueType.ATTRIBUTE)) { - throw new Error('Cannot pass attribute nodes to custom functions'); - } return transformXPathItemToJavascriptObject(value, executionParameters).next( IterationHint.NONE, ).value; diff --git a/test/specs/parsing/registerCustomXPathFunction.tests.ts b/test/specs/parsing/registerCustomXPathFunction.tests.ts index 88fef04ba..63bf02af2 100644 --- a/test/specs/parsing/registerCustomXPathFunction.tests.ts +++ b/test/specs/parsing/registerCustomXPathFunction.tests.ts @@ -280,13 +280,12 @@ describe('registerCustomXPathFunction', () => { ); }); - it('disallows attributes as parameters', () => { - chai.assert.throws( - () => - evaluateXPathToString('test:custom-function3(//@*)', documentNode, null, null, { - namespaceResolver: identityNamespaceResolver, - }), - 'Cannot pass attribute nodes', + it('allows attributes as parameters', () => { + chai.assert.equal( + evaluateXPathToString('test:custom-function3(//@*)', documentNode, null, null, { + namespaceResolver: identityNamespaceResolver, + }), + 'someValue', ); });