Jump to content

surveyer

Members
  • Posts

    4
  • Joined

  • Last visited

Everything posted by surveyer

  1. Anyone can help me?I want to check whether an element is in the list of tags.
  2. This is the output of your code:nono I just want one 'no' since Jane is not in the list.Btw, this is my code that yields that 2 'no's <xsl:template match="Workers"> <xsl:apply-templates select="Worker"/></xsl:template><xsl:template match="Worker"><xsl:choose><xsl:when test="name='Jane'">yes</xsl:when><xsl:otherwise>no</xsl:otherwise></xsl:choose></xsl:template>
  3. If I use 'if' or 'when' to find that Jane is in the Workers list, it can be done:<xsl:if test="$wname=$ename"><found><xsl:value-of select="$wname"></found></xsl:if>But if I use 'if' or 'when' to find that Jane should not be in the Workers list, that I cannot know how:<xsl:for-each blah blah blah><xsl:choose><xsl:when test="$wname!=$ename"><notfound><xsl:value-of select="$ename"></notfound></xsl:when></xsl:choose></xsl:for-each>This last code will give two redundant answers if 'printed' into HTML:<notfound>Jane</notfound><notfound>Jane</notfound>
  4. Hi there,I am new to XML and XSL, so please bear with me if I ask simple questions.At the moment I have a problem to check availability of a worker in a list of workers.Here is the code:<Workers> <Worker id="1"> <name>John</name> </Worker> <Worker id="2"> <name>Smith</name> </Worker></Workers>I want to check if there is a worker called 'Jane' in the XML above by using XSL.<employees> <employee> <name>Jane</name> </employee></employees>And if Jane is not in the XML, I want to return a notification that Jane is not in the XML.How could I do this?Please help me.
×
×
  • Create New...