welcomemarie Posted February 28, 2008 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 Link to comment Share on other sites More sharing options...
Reg Edit Posted February 28, 2008 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. Link to comment Share on other sites More sharing options...
boen_robot Posted February 28, 2008 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. Link to comment Share on other sites More sharing options...
welcomemarie Posted February 29, 2008 Author 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. Link to comment Share on other sites More sharing options...
Reg Edit Posted February 29, 2008 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. Link to comment Share on other sites More sharing options...
boen_robot Posted March 1, 2008 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. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.