Skip to Content
author's profile photo Former Member
Former Member

explain

Hi! I'm new to xsl. Can anyone explain me what does the below templete do. What values does itemIndex1 and intemIndex2 parameter hold.

<xsl:template name="hierarchy">

<!-- THIS EXTRACTS THE ITEM-CHILD PACKAGING RELATIONSHIP-->

<xsl:param name="loopControl"/>

<xsl:param name="itemIndex2"/>

<xsl:param name="sortedNodes"/>

<xsl:param name="unsortedNodes"/>

<xsl:variable name="followingSibling">

<xsl:value-of select="$sortedNodes/E1MARMM[$itemIndex2 + 1]"/>

</xsl:variable>

<xsl:variable name="precedingSibling">

<xsl:value-of select="$sortedNodes/E1MARMM[$itemIndex2 - 1]"/>

</xsl:variable>

<!-- detemine whether this element has any siblings -->

<xsl:variable name="onlyChild">

<xsl:choose>

<xsl:when test="string-length($followingSibling)=0 and string-length($precedingSibling)=0">

<xsl:value-of select="true()"/>

</xsl:when>

<xsl:otherwise>

<xsl:value-of select="should-return-empty-string"/>

</xsl:otherwise>

</xsl:choose>

</xsl:variable>

</sl:template

Add comment
10|10000 characters needed characters exceeded

1 Answer

  • Posted on Aug 02, 2006 at 07:21 AM

    Hi Hemal,

    the template is called with parameter. One of this is named 'itemIndex2'. We dont have 'itemIndex1'. You can refer a variable with a $ ($itemIndex2). '$itemIndex2 + 1' is a adding operation.

    To understand you need to know the rest (other templates) of the stylesheet.

    Regards,

    Udo

    Add comment
    10|10000 characters needed characters exceeded