distinct help

hello as it is possible to be known. Doing distinct I number of elements of a registry I have proven with:

for $d in distinct(/book/Titulo)
return {
count($d)
}

does not work.

Hi,

A distinct() function is not part of the W3C draft. Instead it specifies the
distinct-values() function which extracts distinct values from a given input sequence. Applied on a node sequence it extracts the typed value from each node and performs a duplicate elimination.

In order to count the number of distinct values hold by the “Titulo” element you have to rewrite your query in the following way:

count(distinct-values(input()/book/Titulo))

Best regards,

Thorsten Fiebig

As it is the space of names of this function???. it returns unknown function

declare namespace xf = “http://www.w3.org/2002/08/xquery-functions
count(xf:distinct-values(input()/Titulos/Titulo))

Hi,

You don’t need to specify a namespace for the distinct-values() function, since it belongs to the default function namespace. Please note that the support for distinct-values() was introduced with Tamino 4.2.

Best regards,

Thorsten Fiebig

This is what gives back when proving function? in XQUERY count(distinct-values(input()/monografia/Titulos/Titulo) some idea? my version of Tamino is Tamino 4.1.4.1

<?xml version="1.0" encoding="windows-1252" ?>

Hi,

There is definitely no support for distinct-values() in Tamino 4.1.4. You have to go for a newer version.

Best regards,

Thorsten Fiebig