xml - Sorting with xslt 1.0 -
i have evaluation form filled in lot of users. created export in excel form. want achieve is: header of excel have questions , below every question answers grouped user filled in form. this, i'm getting questions evaluation form , order them position, i'm grouping users filled in form, looping through results of grouping have same lines every question. part of xml i'm generating:
<questionnames> <item> <quesid>468</quesid> <quesname><![cdata[name]]></quesname> </item> <item> <quesid>554</quesid> <quesname><![cdata[palce]]></quesname> </item> </questionnames> <exportline> <items> <item> <quesid>468</quesid> <values> <userid>25151</userid> <value><![cdata[dommel]]></value> <userid>45372</userid> <value><![cdata[omnium]]></value> <userid>54632</userid> <value><![cdata[het zand]]></value> <userid>56604</userid> <value><![cdata[rijen]]></value> <userid>57103</userid> <value><![cdata[schanswiel]]></value> ------ </values> </item> </items> </exportline> <exportline> <items> <item> <quesid>554</quesid> <values> <userid>22523</userid> <value><![cdata[test,test]]></value> <userid>44308</userid> <value><![cdata[ede]]></value> <userid>47850</userid> <value><![cdata[drachten]]></value> <userid>50156</userid> <value><![cdata[dalfsen]]></value> <userid>50656</userid> <value><![cdata[dongen]]></value> ----- </values> </item> </items> </exportline>
this xslt part:
<xsl:template name="enqutequestions"> <tr> <xsl:for-each select="questionnames/item"> <td align="left"><xsl:value-of select="quesname" /></td> </xsl:for-each> </tr> <tr> <xsl:for-each select="questionnames/item"> <xsl:variable name="quesid" select="quesid" /> <td align="left"> <xsl:for-each select="exportline/items/item[quesid=$quesid]/values/value"> <xsl:sort select="value"/> <xsl:value-of disable-output-escaping="yes" select="." /><br /> </xsl:for-each> </td> </xsl:for-each> </tr>
the problem that: in excel file, answers not matched, mean answers of second question not match answers of first.
now have:
name |place -------------------------- dommel | test, test ----> need make sure answers of second question match answer of first question.
let me know if not clear , if have suggestions solve this.
thanks in advance.
in for-each context node value element xsl: sort should select="."
.
Comments
Post a Comment