Link to home
Start Free TrialLog in
Avatar of eladr
eladr

asked on

xsl if statment

hi...
i want to make if statment in my xsl style-sheet which
will act upon the answer from the xsl method childNumber.
i need to do something like that (this is wrong syntax, of course)
<xsl:template match="application">
     <xsl:if <xsl:eval>childNumber(this)</xsl:eval> >1
          do something
     </xsl:if>
</xsl:template>
Avatar of psilli1
psilli1

<xsl:template match="application">
    <xsl:if <xsl:eval>childNumber(this)</xsl:eval> >1 >
         do something
    </xsl:if>
</xsl:template>
Avatar of eladr

ASKER

thanks.
it's very similar to what i wrote.
in now raising points (another 5 )
for simple next que.:
i want to make if statment on some node and to see what is
parent node and to act upon.
like this

<xsl:if my currentNode parent<>"theParentTag">
   'do something
</xsl:if>

p.s. : theParentTag is the xml tag : <theParentTag>
and not the value inside it.
<theParentTag>value</theParentTag>

what is the correct syntax?
I would try something like this

<xsl:choose>
      <xsl:when test="childNumber(this)[. $gt$ 1]">
         'do something here
      </xsl:when>
      <xsl:otherwise>
         'default to some other action
      </xsl:otherwise>
 
</xsl:choose>
Avatar of eladr

ASKER

please explain this strange :
<xsl:when test="childNumber(this)[. $gt$ 1]">
whats $gt$ mean?
       
Greater than
Avatar of eladr

ASKER

hi...
thanks Dave_Greene and psilli1 .
Dave_Greene will get the points and
psilli1 will get 10 points.
psilli1 ,watch for "for psilli1 " in the XML topic

eladr


ASKER CERTIFIED SOLUTION
Avatar of Dave_Greene
Dave_Greene

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
This question was LOCKED with a PROPOSED ANSWER and awaits your decision today.
If the Proposed Answer helped you, please accept it and award that expert.  If it did not
help you, please reject it and add comments as to status and what else is needed.

If you wish to award multiple experts, just comment here with detail.

Your response in finalizing this old question is appreciated.

Moondancer
Community Support Moderator @ Experts Exchange