1

This works in XMLSPy but not in oXygen 21 with Saxon 12.5:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions">
<xsl:variable name="x" select="('a', 'b')" as="xs:string+" />
        <xsl:variable name="y" select="('b', 'c')" as="xs:string+"/>
        <xsl:variable name="a_exc_y" select="$x except $y"/>
</xsl:stylesheet>

Error in oXygen is:

The required item type of the first operand of 'except' is node(). The supplied value is an atomic value.

I initially built the list of strings from element attributes, but I simplified it to static lists, but nothing helps.

I have tried using data($x), I've tried type casting to xs:anyAtomicValue* but nothing gets me past this error/warning in oXygen. Should this not be possible?

Update: XMLSpy doesn't work either. One could save the file without errors, but when running a test, the same type of error presented itself. So it seems like one cannot use set operations on sequences of strings?

2
  • 2
    Yes, except was new in XPath 2.0 but was introduced together with intersect in addition to e.g. | or union and is defined for sequences of nodes. I don't think XPath 3.1 has something for sequences of atomic values or mixed sequences, with XPath 4.0 those operators will be generalized to GNodes qt4cg.org/specifications/xquery-40/xpath-40.html#combining_seq but my current understanding is that means maps and arrays (converted to GNodes) in addition to XML nodes. Commented Oct 10 at 11:55
  • 2
    In the end it depends on what you want to achieve, if you just want to filter out based on the other sequence then e.g. ('a', 'b')[not(. = ('b', 'c'))] should do, otherwise (if you want removal of duplicates) you need ('a', 'b')[not(. = ('b', 'c'))] => distinct-values(). Commented Oct 10 at 12:01

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.