Subject: Re: [xsl] most efficient flat file listing to hierarchical From: "Andrew Welch" <andrew.j.welch@xxxxxxxxx> Date: Thu, 11 Jan 2007 10:46:48 +0000 |
nice....the recursion route seems to be the general approach, just about scratched it out myself (w/o the part bit)
Mine can be tidied a bit to get rid of two of the tokenize()'s - first by using current-grouping-key() for $part as it evaluates to the same thing (bit slow this morning) and then using Georges neat way of passing current-group() to further process the group:
<xsl:template name="process"> <xsl:param name="depth" as="xs:integer"/> <xsl:param name="seq"/> <xsl:for-each-group select="$seq" group-by="tokenize(., '/')[$depth]"> <xsl:variable name="part" select="current-grouping-key()"/> <xsl:choose> <xsl:when test="contains($part, '.')"> <file name="{$part}"/> </xsl:when> <xsl:otherwise> <dir name="{$part}"> <xsl:call-template name="process"> <xsl:with-param name="depth" select="$depth + 1"/> <xsl:with-param name="seq" select="current-group()"/> </xsl:call-template> </dir> </xsl:otherwise> </xsl:choose> </xsl:for-each-group> </xsl:template>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] most efficient flat file , James Fuller | Thread | Re: [xsl] most efficient flat file , Dimitre Novatchev |
Re: [xsl] Problem retaining HTML ta, Abel Braaksma | Date | RE: [xsl] Problem retaining HTML ta, Lalit.Chanchlani |
Month |