[Home] [By Thread] [By Date] [Recent Entries]
davep wrote:
Given input such as <fonts> <entry href="/apps/jdk/lib/fonts/LucidaTypewriterRegular.ttf">Lucida</entry> <entry href="/apps/jdk/lib/fonts/LucidaTypewriterBold.ttf">Lucida</entry> <entry href="/apps/jdk/lib/oblique-fonts/LucidaSansDemiOblique.ttf">Lucida</entry> </fonts> <xsl:template match="fonts"> <xsl:copy> <xsl:for-each-group select="entry" group-by="string-join(tokenize(@href, '/')[position() lt last()], '/')> <dir href="{current-grouping-key()}"> <xsl:apply-templates select="current-group()"/> </dir> </xsl:for-each-group> </xsl:copy> </xsl:template <xsl:template match="entry">
<entry href="{tokenize(@href, '/')[last()]}">
<xsl:value-of select="."/>
</entry>
</xsl:template>Untested. -- Martin Honnen --- MVP Data Platform Development http://msmvps.com/blogs/martin_honnen/
|

Cart



