Hi,

Its bit urgent!

Can someone please show me how to use nested loop.

I have following XML file. I need to print amount in minus if any of the ApplicationReply value is credit, else the Amount should be positive.

<xsl:for-each select="Reply/ApplicationReplies/ApplicationReply[@Name='credit']">

<xsl:if test="position() = 1">

<xsl:value-of select="concat($sep, $sign, /Reply/Amount,$sep)"/>

</xsl:if>

</xsl:for-each>

It prints -Amount if Name is credit.

How do i get else? if its not credit?

<Reply>
   <ApplicationReplies>
	<ApplicationReply Name="auth">
	 	<RCode>1</RCode>
		<RFlag>SOK</RFlag>
		<RMsg>successfully.</RMsg>
	</ApplicationReply>
	<ApplicationReply Name="bill">
		<RCode>1</RCode>
		<RFlag>SOK</RFlag>
		<RMsg>successfully.</RMsg>
	</ApplicationReply>
	<ApplicationReply Name="credit">
		<RCode>1</RCode>
		<RFlag>SOK</RFlag>
		<RMsg>successfully.</RMsg>
	</ApplicationReply>
  </ApplicationReplies>
  
  <amount> 100 <amount>
</Reply>
<xsl:for-each select="Reply/ApplicationReplies/ApplicationReply">
	<xsl:choose>
		<xsl:when test="@Name='credit'">
			<xsl:value-of select="concat($sep, $sign, /Reply/Amount, $sep)"/>
		</xsl:when>
		<xsl:otherwise>
			<xsl:value-of select="concat($sep, /Reply/Amount, $sep)"/>
		</xsl:otherwise>
	</xsl:choose>
</xsl:for-each>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.