Jump to content

Compare strings!


welcomemarie

Recommended Posts

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

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

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

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...