Jump to content

Compare strings!


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 post
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 post
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 post
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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...