QuickBooksDev Posted December 11, 2012 Posted December 11, 2012 We receive an XML document that has several repeating elements. These are optional and can have from 0 to n number. We can only handle 2. How do we just get the first 2 of a set? The for-each gets all which messes up the output that we need. Below is an example of the incoming XML <opts length="4"><opt>Val1</opt><opt>Val2</opt><opt>Val3</opt><opt>Val4</opt></opts>
boen_robot Posted December 23, 2012 Posted December 23, 2012 Adjust the for-each's XPath so that it only matches the desired number, e.g. <xsl:for-each select="opts/opt[position() <= 2]">
Recommended Posts
Archived
This topic is now archived and is closed to further replies.