As far as I can see, all the versions of a temporal document generate triples when using TDE.
How is it possible to restrict them to the collection latest? I do not want to have triples from past versions when I SPARQL.
The latest versions of temporal documents will be in the "latest" collection. You can specify the collections of a view in the template definition. Define the template to use the "latest" collection and the temporal collection to extract the latest documents. The snippet below shows a template which will index nodes from the "latest" and "temporal-collection" collections.
<tde:template xmlns:tde='http://marklogic.com/xdmp/tde'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xsi:schemaLocation='http://marklogic.com/xdmp/tde'>
<tde:context>/</tde:context>
<tde:collections>
<tde:collections-and>
<tde:collection>latest</tde:collection>
<tde:collection>temporal-collection</tde:collection>
</tde:collections-and>
</tde:collections>
<tde:enabled>true</tde:enabled>
<tde:rows>
<tde:row>
<tde:schema-name>myschema</tde:schema-name>
<tde:view-name>myview</tde:view-name>
<tde:columns>
<tde:column>
<tde:name>mycolumn</tde:name>
<tde:scalar-type>string</tde:scalar-type>
<tde:val>myvalue</tde:val>
</tde:column>
</tde:columns>
</tde:row>
</tde:rows>
</tde:template>