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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T09:32:38+00:00 2026-05-13T09:32:38+00:00

I have some experience with XSLT but now i’ve got myself a problem: I

  • 0

I have some experience with XSLT but now i’ve got myself a problem:
I need to check if a period between a begin- and enddate completely covers an other period.

Here’s a part of the xml:

<Parent ID="1">
  <StartDate>20050101</StartDate>
  <EndDate>20060131</EndDate>
  <Child ID="1">
    <StartDate>20050101</StartDate>
    <EndDate>20081231</EndDate>
  </Child>
</Parent>
<Parent ID="2">
  <StartDate>20060201</StartDate>
  <EndDate>20071231</EndDate>
  <Child ID="1">
    <StartDate>20050101</StartDate>
    <EndDate>20081231</EndDate>
  </Child>
</Parent>
<Parent ID="3">
  <StartDate>20080101</StartDate>
  <EndDate>20081231<EndDate>
  <Child ID="1">
    <StartDate>20050101</StartDate>
    <EndDate>20081231</EndDate>
  </Child>
</Parent>

So i need to check if the period between start and end of the Parent is fully covered by the period between start and end of the Child in XSLT and write the Parent and Child ID’s to xml for fails.

Can someone give me a head start how to manage this in XSLT…?

I have full control over the structure of the XML so when it’s easier with an other XML structure (with the same data) i can change it.

Thanks a lot!

  • 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-05-13T09:32:38+00:00Added an answer on May 13, 2026 at 9:32 am

    Using simple string comparison this is easy, because your date format is big-endian. Here’s a quick XSLT document I wrote up to test it out:

    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <xsl:output method="xml" version="1.0" indent="yes"/>
    
      <xsl:template match="/">
        <root>
          <xsl:for-each select="//Parent">
            <parent>
              <xsl:attribute name="id">
                <xsl:value-of select="@ID"/>
              </xsl:attribute>
              <xsl:choose>
                <xsl:when test="(Child/StartDate &lt;= StartDate) and 
                  (Child/EndDate &gt;= EndDate)">
                  <xsl:text>OK</xsl:text>
                </xsl:when>
                <xsl:otherwise>
                  <xsl:text>Not OK</xsl:text>
                </xsl:otherwise>
              </xsl:choose>
            </parent>
          </xsl:for-each>
        </root>
      </xsl:template>
    </xsl:stylesheet>
    

    Obviously you’ll need your own checks to make sure that StartDate is before EndDate for both parent and child.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some experience making multiplayer turn-based games using sockets, but I've never attempted
I'm new to NAnt but have some experience with Ant and CruiseControl. What I
I am working on a rails application (I have some experience with rails). But,
I have some experience using parallel extensions in .Net development, but I was looking
I'm pretty new to Android development, but I have some experience with Java and
I am a web-developer working in PHP. I have some limited experience with using
I have some UI in VB 2005 that looks great in XP Style, but
I have some experience in AJAX development, mostly on .NET and MooTools. However, I
I have some experience in ASP.Net and can work my way around it without
I have some experience of Objective-C/Cocoa programming on Mac and I'd like to start

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.