Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9169973
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:57:09+00:00 2026-06-17T15:57:09+00:00

I have a below for-each loop in my XSLT which gives me concatenated string

  • 0

I have a below for-each loop in my XSLT which gives me concatenated string of distinct values of CUST_PO_NUMBER from input XML

<xsl:key name="custpo"
         match="LIST_G_DELV/G_DELV/LIST_G_INV_LINES/G_INV_LINES"
         use="CUST_PO_NUMBER"/>
<xsl:template match="XXFIN_GBL_RAINV_PRINT">
    <xsl:apply-templates select="LIST_G_INV"/>
</xsl:template>
<xsl:template match="LIST_G_INV">
    <xsl:for-each select="G_INV">
        <xsl:value-of select="CUSTOMER_TRX_ID"/>
        <xsl:text>|</xsl:text>
        <xsl:value-of select="substring(LIST_G_SEB/G_SEB/SEB_NAME,1,255)"/>
        <xsl:text>|</xsl:text>
        <xsl:value-of select="substring(IDM_BILL_TO_CUSTOMER_NAME,1,255)"/>
        <xsl:text>|</xsl:text>
        <xsl:value-of select="BILL_TO_CUSTOMER_NUMBER"/>
        <xsl:text>|</xsl:text>
        <xsl:value-of select="TRX_NUMBER"/>
        <xsl:text>|</xsl:text>
        <xsl:for-each select="LIST_G_DELV/G_DELV/LIST_G_INV_LINES/G_INV_LINES[generate-id()=generate-id(key('custpo',CUST_PO_NUMBER)[1])]">
            <xsl:value-of select="CUST_PO_NUMBER"/>
            <xsl:if test="not(position() = last())">
                <xsl:text>;</xsl:text>
            </xsl:if>
        </xsl:for-each>
        <xsl:text>|</xsl:text>
        <xsl:value-of select="CUST_ISO_LANGUAGE"/>
    </xsl:for-each>
</xsl:template>

Ultimately output of this XSLT is CSV file (seperated by pipe | ). Can we just truncate result of for-each loop on CUST_PO_NUMBER element to 1000 characters?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T15:57:10+00:00Added an answer on June 17, 2026 at 3:57 pm

    I believe this should work if you replace the following for-each:

    <xsl:for-each select="LIST_G_DELV/G_DELV/LIST_G_INV_LINES/G_INV_LINES[generate-id()=generate-id(key('custpo',CUST_PO_NUMBER)[1])]">
            <xsl:value-of select="CUST_PO_NUMBER"/>
            <xsl:if test="not(position() = last())">
                <xsl:text>;</xsl:text>
            </xsl:if>
    </xsl:for-each>
    

    with:

     <xsl:variable name="values">
        <xsl:for-each select="LIST_G_DELV/G_DELV/LIST_G_INV_LINES/G_INV_LINES[generate-id()=generate-id(key('custpo',CUST_PO_NUMBER)[1])]">
            <xsl:value-of select="CUST_PO_NUMBER"/>
            <xsl:if test="not(position() = last())">
                <xsl:text>;</xsl:text>
            </xsl:if>
        </xsl:for-each>
     </xsl:variable>
     <xsl:value-of select="substring($values, 1, 1000)" />
    

    and since you’d be using a substring() anyway, you can eliminate the if and text by doing this:

     <xsl:variable name="values">
        <xsl:for-each select="LIST_G_DELV/G_DELV/LIST_G_INV_LINES/G_INV_LINES[generate-id()=generate-id(key('custpo',CUST_PO_NUMBER)[1])]">
            <xsl:value-of select="concat(';', CUST_PO_NUMBER)"/>
        </xsl:for-each>
     </xsl:variable>
     <xsl:value-of select="substring($values, 2, 1001)" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an input string which has csv values. Eg., 1,2,3 I would need
I have a xml that looks like below <xsl:template match=//xml> <xsl:for-each select=//z:row> <ul class
I have below string String str=select * from m_menus; select * from m_roles; I
I have a for each loop is run from an array of around 60,000
I have a string array abc I put this in a for each loop.
I have this VBA below that is designed to loop through each WS and
I have the below code which is attempting to modify each row in a
i have a each loop like below $('#goldBarList tr:not(:eq(0))').filter(':has(:checkbox:checked)').each(function() { $(this).remove(); }); as i
I have the correlated subquery below. Each id (147,148,149) in table1 has many records
I have a data frame like below (20,000 rows by 49 cols). Each row

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.