I'm new to XSLT, but have a nicely working script that I'd like to refine by replacing numeric values for field 'Type' with related strings in the result. In JavaScript, I'd use a switch function but I need the equivalent in XSL
My Table Definition:
<table><tr bgcolor="#6FB6E2">
<th>User Field</th>
<th>Name</th>
<th>Identifier</th>
<th>Type</th>
<th>Parameters</th>
<th>Locked</th>
<th>Mandatory</th>
</tr>
<xsl:for-each select="PREFERENCES/USERCOLUMNS/userColumn">
<tr>
<td>USER<xsl:value-of select="@index"/></td>
<td><xsl:value-of select="@name"/></td>
<td><xsl:value-of select="@identifier"/></td>
<td><xsl:value-of select="@type"/></td>
<td><xsl:value-of select="@parameters"/></td>
<td><xsl:value-of select="@locked"/></td>
<td><xsl:value-of select="@mandatory"/></td>
</tr>
</xsl:for-each>
</table>
My replacement value sets for field "type":
From: ('1', '2', '3', '4', '5')
To: ('Grouping', 'Multi Grouping', 'Hierarchy', 'Multi Hierarchy', 'Linked Hierarchy')
My Sample XML:
<?xml version='1.0' encoding='UTF-8' standalone='yes'?><PREFERENCES>
<USERCOLUMNS count="168">
<userColumn index="33" identifier="user.custom.language" name="Language" locked="false" mandatory="false" type="1"/>
<userColumn index="41" identifier="user.basic.host.presenter" name="Host/Presenter" locked="false" mandatory="false" type="2"/>
<userColumn index="42" identifier="user.basic.subject.line" name="Subject/Line" locked="false" mandatory="false" type="3"/>
<userColumn index="54" identifier="user.extended.best.take" name="Best Take" parameters="YES No Possible" locked="false" mandatory="false" type="4"/>
<userColumn index="55" identifier="user.basic.shoot.date" name="Shoot Date" locked="false" mandatory="false" type="5"/>
</USERCOLUMNS>
</PREFERENCES>
As a bonus question, the "parameters" field includes line feeds as separators for multiple values, but they are not being read as such. In the fourth line, userColumn index="54" the "parameters field has a value of "YES No Possible" which should be three lines showing a word on three lines... Is there anyway to have the table word wrap so that the line feeds are displayed correctly?