welcomemarie 0 Posted February 28, 2008 Report Share Posted February 28, 2008 Can I use "<xsl:choose> <xsl:when test="string(value-of select="position()") = sting(value-of select="$sql")"> <xsl:text> The statement is valid as a success value. </xsl:text> </xsl:when> <xsl:otherwise> <xsl:text> The statement is NOT valid</xsl:text> </xsl:otherwise></xsl:choose>"I think string(value-of select="position()) is a problem. How can I test the two string are equal? Thanks Quote Link to post Share on other sites
Reg Edit 0 Posted February 28, 2008 Report Share Posted February 28, 2008 <xsl:when test="string(value-of select="position()") = sting(value-of select="$sql")">Watch out for the typo in that line ("sting"); however, I think you may mean <xsl:when test=". = '$sql'"> to test the value of the node at the current position.See also http://www.w3schools.com/xsl/xsl_choose.asp. Quote Link to post Share on other sites
boen_robot 107 Posted February 28, 2008 Report Share Posted February 28, 2008 Or you can use <xsl:when test="position() = $sql"> to check if the position of the current node is the same as the value of the $sql parameter. Quote Link to post Share on other sites
welcomemarie 0 Posted February 29, 2008 Author Report Share Posted February 29, 2008 Or you can use<xsl:when test="position() = $sql"> to check if the position of the current node is the same as the value of the $sql parameter. However, I want to compare two strings come from two different .txt? I tried your proposal, but position() can't pass the value of the current node. Quote Link to post Share on other sites
Reg Edit 0 Posted February 29, 2008 Report Share Posted February 29, 2008 However, I want to compare two strings come from two different .txt? I tried your proposal, but position() can't pass the value of the current node.If you want the position of the current node, use boen_robot's example. If you want the value of the current node, use my example. If still stuck please can you explain what you need the xsl to achieve. Quote Link to post Share on other sites
boen_robot 107 Posted March 1, 2008 Report Share Posted March 1, 2008 If Reg Edit's example didn't worked, try it like <xsl:when test=". = $sql"> (notice the missing quotes around the $sql parameter)And yes, if that doesn't work, please be more specific as to what you want your XSLT to achieve. Giving raw samples of XMLs and values for the $sql parameter would also help in this case. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.