Hello.
In my XML document, I have multiple <UMPREAUTHID> elements.
This element is assigned to each <DETAILLINE> and may have a unique or duplicate value.
Using XSLT Version 1.0 I'm using the following to return only the unique values of <UMPREAUTHID>.
Code:
<xsl:for-each select="DETAIL/DETAILLINE">
<fo:inline color="#000000">
<xsl:if test="UMPREAUTHID[.!='']>
<xsl:if test="not(UMPREAUTHID[.=parent::*/preceding-sibling::*/UMPREAUTHID])">
<xsl:value-of select="UMPREAUTHID"/>
<fo:inline font-size="4pt"> </fo:inline>
</xsl:if>
</xsl:if>
</fo:inline>
</xsl:for-each>
For example, here are some values:
<UMPREAUTHID>UMPREAUTH_NBR1</UMPREAUTHID>
<UMPREAUTHID>UMPREAUTH_NBR2</UMPREAUTHID>
<UMPREAUTHID>UMPREAUTH_NBR1</UMPREAUTHID>
<UMPREAUTHID>UMPREAUTH_NBR3</UMPREAUTHID>
<UMPREAUTHID>UMPREAUTH_NBR4</UMPREAUTHID>
<UMPREAUTHID>UMPREAUTH_NBR5</UMPREAUTHID>
<UMPREAUTHID>UMPREAUTH_NBR3</UMPREAUTHID>
However, I want to limit the return of unique <UMPREAUTHID> values to only three values. So, using the above example values, I only want to return
UMPREAUTH_NBR1 UMPREAUTH_NBR2 UMPREAUTH_NBR3
Is there a way to accomplish this?
I would also like to replace the space between each <UMPREAUTHID> with a comma but I can't have a comma after the last <UMPREAUTHID> displayed. So,
Code:
<fo:inline font-size="4pt"> </fo:inline>
would be replaced with
Code:
<fo:inline>,</fo:inline>
I'm not sure how to do prevent the last comma from displaying.
Any help will be greatly appreciated!
Thanks,
Rita