Switching list content dynamically ...
Dear All,
I currently have an XSLT template which displays a variety of selectable lists which are used to filter the data in the main form. These work fine. Now I would like to allow the user to select the values declared in the lists to allow a wider variety of selection (e.g. rather than displaying a list of 'Plants', the list would switch to display a list of 'departments' or 'teams').
At the moment I use the following syntax (excerpts) ...
[... code ... key declaration: ]
<xsl:key name="kplnt" match="PLANT" use="." />
[... code ... selection form: ]
<form name="formsel" id="formsel">
[... code ... List of Plants: ]
<label for="selplnt">Plant</label><br />
<select size="5" name="selplnt" id="selplnt">
<xsl:apply-templates select="//PLANT[generate-id()=generate-id(key('kplnt',.))]" mode="selectplnt">
<xsl:sort order="ascending"/>
</xsl:apply-templates>
</select>
[... code ... Run call to javascript: ]
<input type="button" value="Run Select" onClick="filter(document.formsel.selplnt.value)"/>
[... code ... End of form: ]
</form>
[... code ... Choose statement activated by selection of Plant $plnt: ]
<xsl:choose>
<xsl:when test="$plnt">
[... code ...]
[... Key declaration: ]
<xsl:template match="//PLANT[generate-id()=generate-id(key('kplnt',.))]" mode="selectplnt">
<option value="{.}"><xsl:value-of select="."/></option>
</xsl:template>
Here I use javascript to apply filters to my display and so I am hoping that I can integrate an extra piece of code to 'flip' the contents of the List Boxes (in this example 'Plant'). Once I have got this working, then I will see if I can flip the display in the main body of the display. This would give a lot of extra flexibility and allow the users to browse a lot more data.
Anyway, I hope that somone out there has come across and has tackled similar issues and can point me in the right direction :-)
Many thanks,
Alan Searle
PS: I have done quite a lot of googling and notice that Jenny Tennison offers some examples of mixed sources of data and/or XSL. However, this seemed to be static whereas I am looking for a dynamic method that can be switched by the user.
|