cancel
Showing results for 
Search instead for 
Did you mean: 

XSL with repeating item-lines processes only the first item

Former Member
0 Kudos

Hi all,

I am a novice to XSLT. I have created an XSL which looks roughly as follows:

<xsl:template match="/">

<ns0:MT_messagetype....>

---<Header>

-


<tag1>

-


<tag2>

---</Header>

--<Item>

-


<tag a>

-


<tag b>

-


<etc>

---</Item>

</ns0:...>

</xsl:template>

Now when I import this as an imported archive in XI and test it, only the first item is mapped via this XSL. I have multiple item-lines off course. How must I tell this XSL that the Item-tag is repeating?

Thanks in advance!

William

Accepted Solutions (1)

Accepted Solutions (1)

GabrielSagaya
Active Contributor
0 Kudos

<?xml version='1.0' ?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" />

<xsl:template match="/">

<xsl:MT_messagetype>

<xsl:for-each select = "item">

<item>

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

</item>

</xsl:for-each>

</xsl:MT_messagetype>

</xsl:template>

</xsl:stylesheet>

Former Member
0 Kudos

Thanks you all guys, that did the trick!

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

You have to use <xsl:foreach> for looping purpose in XSLT.

Check for that for duplicating the node.

Thanks,

RamuV

Former Member
0 Kudos

Hi,

try out with this keyword in XSLT..

<xsl:for-each select = "">

</xsl:for-each>

check this..

http://www.w3schools.com/xsl/xsl_for_each.asp

Thanks,

Vijaya.

aashish_sinha
Active Contributor
0 Kudos

Hi,

Have a look into these 2 weblogs.

/people/aashish.sinha/blog/2008/01/17/step-150-by-150-step-simple-approach-for-xslt-mapping

/people/aashish.sinha/blog/2008/01/21/xslt-mapping-for-multiple-segments-of-xml

Regards

Aashish Sinha