cancel
Showing results for 
Search instead for 
Did you mean: 

last() and position() in XSL

Former Member
0 Kudos

Hi All,

I have hierarchy template in my program that runs other segments of program. The third line of code gets only 2 levels of MARMM segment. There are 3 MARMM segments with 2 different MVKEM (For Target Market for Ex. France and US). Since only 2 levels are selected it gives 2 levels for France and 2 for US. I don't know how the last() and postition() works. Can anyone help me to get all the 3 levels for each Target Market (2 TM. France and US in this case, so total 3+3 = 6 records).

<xsl:call-template name="hierarchy">

<xsl:with-param name="loopControl" select="1"/>

<xsl:with-param name="itemIndex2" select="last() - position() + 1"/>

<xsl:with-param name="sortedNodes" select="$sortedNodes"/>

<xsl:with-param name="unsortedNodes" select="$unsortedNodes"/>

</xsl:call-template>

Regards,

Hemal

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Thanks for your reply.

Can you tell me why is the below line of code don't give any output for VKORG? Is the syntax wrong? I want to store valueS for VKORG in the array itemIndex7. There may be multiple VKORG in E1MVKEM.

<xsl:value-of select="substring(E1MARAM/E1MVKEM[$itemIndex7]/VKORG,0,2)" />

Regards,

Hemal

udo_martens
Active Contributor
0 Kudos

Hi Hemal,

>>>>Can you tell me why is the below line of code don't give any output for VKORG?

No, i dont know either the whole program nor the source.

>>>>Is the syntax wrong?

No

Regards,

Udo

udo_martens
Active Contributor
0 Kudos

Hi Hemal,

of course i cant give you a solution coz i dont know eithter the whole style nor the source.

last() gives you the position of the last node in current loop or template.

position gives you the position of the current node in current loop (for-each) or template (match)

Regards,

Udo