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

  • Home
  • SEARCH
  • 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 8540983
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:43:23+00:00 2026-06-11T11:43:23+00:00

How to count unique values when a particular node value is ERROR. The below

  • 0

How to count unique values when a particular node value is ERROR. The below is the xml source. there different data sets like SellOut, SellIn and Inventory but
i want have a unique record count for the RECORD_TYPE=ERROR irrespective of data set type

<SellOutErrorRecord>
    <RECORD_TYPE>WARNING</RECORD_TYPE>
    <ERROR_DESC>record 1:location id is invalid</ERROR_DESC>
    <RECORD_NO>1</RECORD_NO>
    <LOCATION_NAME>XYZ el</LOCATION_NAME>
    <PRODUCT_NUMBER>336549R-001</PRODUCT_NUMBER>
    <PRODUCT_OPTION>0D1</PRODUCT_OPTION>
    <PRODUCT_LINE>LA</PRODUCT_LINE>
</SellOutErrorRecord>
<SalesInErrorRecord>
    <RECORD_TYPE>ERROR</RECORD_TYPE>
    <ERROR_DESC>record 1:location id is invalid</ERROR_DESC>
    <RECORD_NO>1</RECORD_NO>
    <LOCATION_NAME>XYZ el</LOCATION_NAME>
    <PRODUCT_NUMBER>336549R-001</PRODUCT_NUMBER>
    <PRODUCT_OPTION>0D1</PRODUCT_OPTION>
    <PRODUCT_LINE>LA</PRODUCT_LINE>
    <PRODUCT_LINE_TYPE>C</PRODUCT_LINE_TYPE>
</SalesInErrorRecord>
<SellOutErrorRecord>
    <RECORD_TYPE>ERROR</RECORD_TYPE>
    <ERROR_DESC>record 2:SO:invoiced net amount is invalid</ERROR_DESC>
    <RECORD_NO>2</RECORD_NO>
    <LOCATION_NAME>XYZ el</LOCATION_NAME>
    <PRODUCT_NUMBER>3X-KN73C-DB</PRODUCT_NUMBER>
    <PRODUCT_OPTION>0D1</PRODUCT_OPTION>
    <PRODUCT_LINE>HA</PRODUCT_LINE>
    <PRODUCT_LINE_TYPE>E</PRODUCT_LINE_TYPE>
</SellOutErrorRecord>
<SellOutErrorRecord>
    <RECORD_TYPE>ERROR</RECORD_TYPE>
    <ERROR_DESC>record 3:SO:transaction currency is invalid</ERROR_DESC>
    <RECORD_NO>3</RECORD_NO>
    <LOCATION_NAME>XYZ el</LOCATION_NAME>
    <PRODUCT_NUMBER>339112-B25</PRODUCT_NUMBER>
    <PRODUCT_OPTION>0D1</PRODUCT_OPTION>
    <PRODUCT_LINE>J3</PRODUCT_LINE>
    <PRODUCT_LINE_TYPE>E</PRODUCT_LINE_TYPE>
</SellOutErrorRecord>
<SalesInErrorRecord>
    <RECORD_TYPE>WARNING</RECORD_TYPE>
    <ERROR_DESC>record 3:SI:buy quantity is zero</ERROR_DESC>
    <RECORD_NO>3</RECORD_NO>
    <LOCATION_NAME>XYZ el</LOCATION_NAME>
    <PRODUCT_NUMBER>339112-B25</PRODUCT_NUMBER>
    <PRODUCT_OPTION>0D1</PRODUCT_OPTION>
    <PRODUCT_LINE>J3</PRODUCT_LINE>
    <PRODUCT_LINE_TYPE>E</PRODUCT_LINE_TYPE>
</SalesInErrorRecord>
<SalesInErrorRecord>
    <RECORD_TYPE>ERROR</RECORD_TYPE>
    <ERROR_DESC>record 3:SI:transaction document id is invalid</ERROR_DESC>
    <RECORD_NO>3</RECORD_NO>
    <LOCATION_NAME>XYZ el</LOCATION_NAME>
    <PRODUCT_NUMBER>339112-B25</PRODUCT_NUMBER>
    <PRODUCT_OPTION>0D1</PRODUCT_OPTION>
    <PRODUCT_LINE>J3</PRODUCT_LINE>
    <PRODUCT_LINE_TYPE>E</PRODUCT_LINE_TYPE>
</SalesInErrorRecord>
<SellOutErrorRecord>
    <RECORD_TYPE>WARNING</RECORD_TYPE>
    <ERROR_DESC>record 4:SO:invoiced net amount is invalid</ERROR_DESC>
    <RECORD_NO>4</RECORD_NO>
    <LOCATION_NAME>XYZ el</LOCATION_NAME>
    <PRODUCT_NUMBER>445860-B21</PRODUCT_NUMBER>
    <PRODUCT_OPTION>0D1</PRODUCT_OPTION>
    <PRODUCT_LINE>MV</PRODUCT_LINE>
    <PRODUCT_LINE_TYPE>C</PRODUCT_LINE_TYPE>
</SellOutErrorRecord>
<SalesInErrorRecord>
    <RECORD_TYPE>ERROR</RECORD_TYPE>
    <ERROR_DESC>record 5:SI:transaction currency is null or invalid</ERROR_DESC>
    <RECORD_NO>5</RECORD_NO>
    <LOCATION_NAME>XYZ el</LOCATION_NAME>
    <PRODUCT_NUMBER>339112-B25</PRODUCT_NUMBER>
    <PRODUCT_OPTION>0D1</PRODUCT_OPTION>
    <PRODUCT_LINE>J3</PRODUCT_LINE>
    <PRODUCT_LINE_TYPE>E</PRODUCT_LINE_TYPE>
</SalesInErrorRecord>
<InventoryErrorRecord>
    <RECORD_TYPE>ERROR</RECORD_TYPE>
    <ERROR_DESC>record 6:product id is invalid</ERROR_DESC>
    <RECORD_NO>6</RECORD_NO>
    <LOCATION_NAME>XYZ XYZ</LOCATION_NAME>
    <PRODUCT_NUMBER>331184-B21</PRODUCT_NUMBER>
    <PRODUCT_OPTION>0S1</PRODUCT_OPTION>
    <PRODUCT_LINE>R8</PRODUCT_LINE>
    <PRODUCT_LINE_TYPE>E</PRODUCT_LINE_TYPE>
</InventoryErrorRecord>
<SellOutErrorRecord>
    <RECORD_TYPE>ERROR</RECORD_TYPE>
    <ERROR_DESC>record 6:SO:invoiced net amount is invalid</ERROR_DESC>
    <RECORD_NO>6</RECORD_NO>
    <LOCATION_NAME>XYZ el</LOCATION_NAME>
    <PRODUCT_NUMBER>339112-B25</PRODUCT_NUMBER>
    <PRODUCT_OPTION>0D1</PRODUCT_OPTION>
    <PRODUCT_LINE>J3</PRODUCT_LINE>
    <PRODUCT_LINE_TYPE>E</PRODUCT_LINE_TYPE>
</SellOutErrorRecord>

the output has to be record_count=5.
Thanks for your help…

  • 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-11T11:43:25+00:00Added an answer on June 11, 2026 at 11:43 am

    In XSLT 1.0, distincting is rather non intuitive. I’ve assumed the root node is xml and that what makes records unique is the RECORD_NO.

    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
        <xsl:output method="text" indent="no"/>
    
        <xsl:template match="/xml">
            record_count=<xsl:value-of select="count(*[RECORD_TYPE='ERROR' and not(following::*[RECORD_TYPE='ERROR']/RECORD_NO/text() = RECORD_NO/text())])" />
        </xsl:template>
    </xsl:stylesheet>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to know how I can count the number of unique values
Given a cell with string values I would like to count how many different
I need to count the occurrences of all of the unique values from my
I have a dictionary with non unique values and I want to count the
I need to count unique values in range (C2:C2080) in excel. Googled formula: =SUM(IF(FREQUENCY(MATCH(C2:C2080;C2:C2080;0);MATCH(C2:C280;C2:C2080;0))>0;1))
In Java is there an object like a Set that can contain only unique
Paper count if unique paper show inputbox value set value but count multiple paper
I'm trying to retrieve a count of all unique values in a field. Example
Possible Duplicate: Count unique values in R I have just one column full of
I need to count and present distinct/unique values in a dataGridView. I want to

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.