This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Problem with selecting UNIQUE attribute
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: [xsl] Problem with selecting UNIQUE attribute
- From: "Kevin Read" <kevin at synergysa dot com dot au>
- Date: Sun, 17 Jun 2001 19:21:35 +0930
- Reply-To: xsl-list at lists dot mulberrytech dot com
I am building drop downs for the unique values of @names for each directory
at a given level in the following structure along with a list of unique
files types (using file/fileext)
The FileExt drop down works fine and sorts and filters as expected. :-)
It seems that no matter what combination of select expressions I use on the
build-dirlist I am unable to select on the unique values. :-(
I have more than likely been looking at this too long and the answer must be
simple. Any suggestions on what is wrong with the build-dirlist template ?
<?xml version="1.0" encoding="UTF-8"?>
<dirstruct>
<dir level="0" name="XML-0.6">
<file level="0">
<filename>xml.server</filename>
<fileext>SERVER File</fileext>
<filesize>1026</filesize>
<filelastmod>16/05/2001 11:04:34 PM</filelastmod>
</file>
<file level="0">
<filename>LICENSE</filename>
<fileext>File</fileext>
<filesize>26430</filesize>
<filelastmod>16/05/2001 11:04:34 PM</filelastmod>
</file>
<dir level="1" name="bin">
<file level="1">
<filename>synergy.jar</filename>
<fileext>Java File</fileext>
<filesize>12568</filesize>
<filelastmod>16/05/2001 11:04:34 PM</filelastmod>
</file>
</dir>
... ...
... ...
</dir>
</dirstruct>
The following template is called via:
... ...
<xsl:call-template name="build-dirlist">
<xsl:with-param name="LVL">0</xsl:with-param>
</xsl:call-template>
... ...
<xsl:call-template name="build-dirlist">
<xsl:with-param name="LVL">1</xsl:with-param>
</xsl:call-template>
... ...
<xsl:template name="build-dirlist">
<xsl:param name="LVL"/>
<xsl:for-each select="//dir[@level=$LVL and not(preceding::parameter[@name
= @name])]">
<xsl:sort select="@name" order="ascending" />
<option>
<xsl:value-of select="@name"/>
</option>
</xsl:for-each>
</xsl:template>
<xsl:template name="build-filelist">
<xsl:for-each select="//file[not(fileext=preceding::fileext)]">
<xsl:sort select="fileext" order="ascending" />
<option>
<xsl:value-of select="fileext"/>
</option>
</xsl:for-each>
</xsl:template>
Kevin
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list