Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

XSLT for-each within another for-each

Hi All,

My XSLT mapping needs to pick a field(BOL) from the Header and the using that, search the Items node for the matching BOL and generate the output accordingly.

My current XSLT is as follows(not the entire program, just the snippet)

<xsl:for-each select="ns0:Messages/ns0:Message1/ns1:MT_Header/Header">

<xsl:param name="search"><xsl:value-of select="bol"/></xsl:param>

<xsl:for-each select="ns0:Messages/ns0:Message2/ns1:MT_Items/Item[BOL=$search]">

<Output>

<BOL_ITEM><xsl:value-of select="BOL_ITEM"/></BOL_ITEM>

</Output>

</xsl:for-each>

</xsl:for-each>

The following code works correctly(without the outer for-each and with hardcoding)

<xsl:param name="search">100</xsl:param>

<xsl:for-each select="ns0:Messages/ns0:Message2/ns1:MT_Items/Item[BOL=$search]">

<Output>

<BOL_ITEM><xsl:value-of select="BOL_ITEM"/></BOL_ITEM>

</Output>

</xsl:for-each>

So its the for-each within another for-each that does not work . Is there some syntax problem ? Or another way to achieve this in XSLT?

Former Member
Not what you were looking for? View more on this topic or Ask a question