hi guys, i have this block of xslt if-else case and was wondering if there's a way for me to do straight comparison with unicode character?
Something along the lines of the code shown below? Or does xslt have some built in function which i can use for this purpose? i.e. change the unicode into html entities and compare via that method?
Of course if there's a better way please fire away. Thanks.
<xsl:choose>
<xsl:when test="status">
<xsl:if test="status='تم المحاولة'">
<font color="#00CC00"><xsl:value-of select="status" /></font><br/>
<!--a href="/Elearning_Platform/xfiles/reports/view_reports.modcgi?asm_lid={@lom_id}&did={@dispatch_id}&rm_student_id={@person_id}&report_type=2">[View Results]</a-->
</xsl:if>
</xsl:when>
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>
-
If both the source XML and the XSLT are declared as UTF-8 encoded i believe this shouldnt be a problem. If your parser supports EXSLT you can call url-decode(status) directly this resource has some examples + makes a good read about encoding in XSLT in general.
MSalters : Would work with UTF-16 too.melaos : well actually i tried to do direct xsl:if test var=[some arabic text], but it didn't work. And i'm using putty, could this be the cause? thanks.bortzmeyer : I do not think that the encoding of the source XML and the XSLT program matter. XSLt works on the infoset, not on the text representation. -
The answer is positive.
More precisely, any character that can be used within an XML document, can be used as part of an argument to an XPath equality comparison operator.
0 comments:
Post a Comment