[Home] [By Thread] [By Date] [Recent Entries]
Dimitre Novatchev wrote:
On 4/17/07, Scott Lynch <slynch@xxxxxxxxxx> wrote:Dimitre, But note that (the other case) you can use current-group() still when the context item has changed. I.e., in another template which is called or indirectly invoked from your for-each-group. In which case the dot '.' will contain something else then current-group()[1] Btw, you can also do the distinct nodes in a single xpath (the title of your post seems to suggest you were looking for a function), as long as your identity is based on a value (of @id): <xsl:variable name="files" select="document(('file1.xml', 'file2.xml'))" /> <xsl:template match="/" name="main"> <xsl:copy-of select=" for $i in distinct-values($files/*/*/@id) return ($files/*/*[@id = $i])[1]" /> </xsl:template> If you need sorting, you can use xsl:perform-sort, change the xsl:copy-of like this: <!-- or, with sorting -->
<xsl:perform-sort select="
for $i in distinct-values($files/*/bar/@id)
return ($files/*/*[@id = $i])[1]" ><xsl:sort select="@id" /> </xsl:perform-sort> (btw: note the double parentheses around the fn:document() function, they are on purpose) Cheers, -- Abel Braaksma
|

Cart



