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 8857407
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:34:56+00:00 2026-06-14T14:34:56+00:00

I have some XML which I would like to transform into a report showing

  • 0

I have some XML which I would like to transform into a report showing counts on the number of nodes matching a specific criteria within a date period.

Example xml below. I am trying to show a count of nodes based on Status within a date range.

I can match based on date range but I am having trouble showing the status count within that range. Any pointers appreciated.

    <?xml version="1.0" encoding="UTF-8"?>
    <List>
     <Item>
       <Value name="Status">Open</Value>    
       <Value name="Date">2012-09-01</Value>
       <Value name="Name">Item 1</Value>
     </Item>
     <Item>
       <Value name="Status">Open</Value> 
       <Value name="Date">2012-10-15</Value>
       <Value name="Name">Item 2</Value>
     </Item>
     <Item>
       <Value name="Status">Open</Value> 
       <Value name="Date">2012-10-15</Value>
       <Value name="Name">Item 3</Value>
     </Item>
     <Item>
       <Value name="Status">Pending</Value> 
       <Value name="Date">2012-10-20</Value>
       <Value name="Name">Item 4</Value>
     </Item>
     <Item>
       <Value name="Status">Closed</Value>
       <Value name="Date">2012-10-30</Value>
       <Value name="Name">Item 5</Value>
     </Item>
    </List>

Example output would be:-

   Status         2012-10-01 - 2012-10-31
   Open           2
   Closed         1
   Pending        1
  • 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-14T14:34:57+00:00Added an answer on June 14, 2026 at 2:34 pm

    As simple as this:

    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
     <xsl:output omit-xml-declaration="yes" indent="yes"/>
     <xsl:strip-space elements="*"/>
    
     <xsl:param name="pStartDate" select="20121001"/>
     <xsl:param name="pEndDate" select="20121031"/>
    
     <xsl:template match="/">
       <xsl:variable name="vInRange" select=
        "/*/*[translate(Value[@name='Date'],'-','') >= $pStartDate
             and
              $pEndDate >= translate(Value[@name='Date'],'-','')
             ]"/>
         Open      <xsl:value-of select="count($vInRange[Value[@name='Status']='Open'])"/>
         Closed    <xsl:value-of select="count($vInRange[Value[@name='Status']='Closed'])"/>
         Pending   <xsl:value-of select="count($vInRange[Value[@name='Status']='Pending'])"/>
     </xsl:template>
    </xsl:stylesheet>
    

    When this transformation is applied on the provided XML document:

    <List>
        <Item>
            <Value name="Status">Open</Value>
            <Value name="Date">2012-09-01</Value>
            <Value name="Name">Item 1</Value>
        </Item>
        <Item>
            <Value name="Status">Open</Value>
            <Value name="Date">2012-10-15</Value>
            <Value name="Name">Item 2</Value>
        </Item>
        <Item>
            <Value name="Status">Open</Value>
            <Value name="Date">2012-10-15</Value>
            <Value name="Name">Item 3</Value>
        </Item>
        <Item>
            <Value name="Status">Pending</Value>
            <Value name="Date">2012-10-20</Value>
            <Value name="Name">Item 4</Value>
        </Item>
        <Item>
            <Value name="Status">Closed</Value>
            <Value name="Date">2012-10-30</Value>
            <Value name="Name">Item 5</Value>
        </Item>
    </List>
    

    the wanted, correct result is produced:

     Open      2
     Closed    1
     Pending   1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some simple XML which I would like to parse into an array
I have some XML which I would like to serialize into a class. <Group>
I have some XML which I would like to serialize into a class. <MasterData>
I have some XML where I would like to remove identical consecutive child nodes,
I have some XML which contains records and sub records, like this: <data> <record
I have some XML like <ITEM><TITLE>Video: High Stakes for <KW>Obama</KW> &amp; Romney</TITLE></ITEM> which I
I have some simple function in Flex in which I would like to send
I have some XML which features a fair number of attributes in each element,
I have a list of values in my XML file which I would like
i have some xml with math ml inside, and i would like to find

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.