Hello im basically creating a form based system using drop down menu's where as I have an XML document, then am processing that using an XSL (HTML ORITENTATED) document, sending them both to a JSP and processing them to output xhtml.

My problem is that in the form drop down menu from the XML I extract many peices of information which are the same. For instance say im making a list of the courses, but the 'Computer science' course is listed 3 times I want to only list that course in the menu once. I've got around this problem using a predicate as follows.

Code:
<xsl:apply-templates select="curriculum/modules/module/subject[not(.=preceding::subject/.)]" mode="q2d" />
The problem in facing now is that im only extracting part of the XML from a document, for instance module codes like CSCI1401, CSCI1408, INFO2403. I only want to retreive the first 4 letters of these module codes, so to do this im using substring(.,1,4) however I can get rid of duplicates in the way that I dont have two CSCI1401's but I can't seem to get the drop down menu to just contain 1 instance of CSCI, INFO, etc.

Any ideas on how you remove duplicates when you're trying to remove them based on a substring? It won't let me put the substring function directly into the tree structure because it requires a node ;s