This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
$input-context/bib/book[3]/title | root($input-context/bib/book[3]/title) fails static typechecking because root takes node()?, not node()*.
One way to allow this expression to pass staic type checking would be to filter the operand of fn:root: $input-context/bib/book[3]/title | root(($input-context/bib/book[3]/title)[1])
>One way to allow this expression to pass staic type checking would be to filter the operand of fn:root: $input-context/bib/book[3]/title | root(($input-context/bib/book[3]/title)[1]) This really demonstrates worst possible practice. To get the query through static cardinality checking, you change the expression in such a way that there is no cardinality checking at all, whether static or dynamic. If static type checking is going to encourage people to do this sort of thing, then it is a really bad idea.
Fixed the test using fn:exactly-one function: $input-context/bib/book[3]/title | root(fn:exactly-one($input-context/bib/book[3]/title))