OK,
Within my Php, I have a standard xslTranslator() method which takes in:
- The XML (string datatype, in my case the possible values of a DDLB)
- The filename.xsl (the XSLTemplate for the XML, in my case the iteration to embed the above values into a DDLB)
- A Params Array (external parameters which will also affect the XSLT but are not part of the pure XML, in my case, a csv string which lists the values previously selected in a multiple DDLB).
Params are a standard way of passing data to XSLT but they do not handle Arrays. So, I collapsed my array into a csv string so it could be passed as a single Param.
The inportant XSL command is the 'contains' which checks my parameter string.
Here's an example snippet:
<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="
version="1.0">
<xsl

aram name='lostofnumbersParamString' select="'aDefaultValueNotUsed'"/>
<xsl:template match='/'>
<table>
<tr>
<td align='left'>
<xsl:apply-templates select='listofnumbers'></xsl:apply-templates>
</td>
</tr>
</table>
</xsl:template>
<xsl:template match='listofnumbers'>
<xsl:call-template name='numbersDDLB'/>
</xsl:template>
<xsl:template name="numbersDDLB">
<select name='numbersSelected[]' id='numbersSelected'>
<xsl:attribute name='size'>5</xsl:attribute>
<xsl:attribute name='multiple'>multiple</xsl:attribute>
<xsl:for-each select="xmlNumberSeq">
<xsl:sort/>
<option>
<xsl:if test="contains($lostofnumbersParamString, @anXmlNumber)">
<xsl:attribute name='selected'>selected</xsl:attribute>
</xsl:if>
<xsl:attribute name='value'><xsl:value-of select='@anXmlNumber'/></xsl:attribute>
<xsl:value-of select='@anXmlNumber'/>
</option>
</xsl:for-each>
</select>
</xsl:template>
</xsl:stylesheet>
Hope this helps,
Joseppic.