XSLT Parsing Error

I am getting this error:

Schema validation error at LineNumber: [1], LinePosition: [421], Message: [The element 'CriticalDateFields' in namespace 'http://integration.cbre.com/schemas/gcs/leasecriticaldates/v1' has invalid child element 'SquareArea' in namespace 'http://integration.cbre.com/schemas/gcs/leasecriticaldates/v1'. List of possible elements expected: 'CriticalDateValue' in namespace 'http://integration.cbre.com/schemas/gcs/leasecriticaldates/v1'.], SourceSchemaObject: [], SourceUri: []


Here is my XSLT:


<?xml version="1.0" encoding="UTF-8"?>

<!--  Event Mapping (For Horizon to CIM)
          VERSION :           V1
          INITIAL DATE:                        08/14/2013
          LAST UPDATED DATE:       08/22/2013      
      Created By:         Mani
      -->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns="http://integration.cbre.com/schemas/gcs/leasecriticaldates/v1"
    xmlns:common="http://integration.cbre.com/schemas/gcs/common/v1"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"    
    version="1.0" >

  <xsl:output indent="yes"/>

  <xsl:template match="batch">
    <Lease xmlns="http://integration.cbre.com/schemas/gcs/leasecriticaldates/v1"
           xmlns:common="http://integration.cbre.com/schemas/gcs/common/v1"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <xsl:apply-templates select="row"/>
    </Lease>
  </xsl:template>

  <xsl:template match="row">
    <ClientId>HP</ClientId>
   
    <LeaseId>
      <xsl:value-of select="LeaseID"/>
    </LeaseId>
   
    <CriticalDates>
      <CriticalDateFields>
        <CriticalDateId>
          <xsl:value-of select="EventSequenceNumber"/>
        </CriticalDateId>
       
        <CriticalDateType>
          <common:Code>
            <xsl:value-of select="LeaseEventTypeID"/>
          </common:Code>
          <common:Description>
            <xsl:value-of select="LeaseEventTypeID"/>
          </common:Description>
        </CriticalDateType>

        <xsl:if test="NotificationDate">
          <CriticalDateValue>
            <xsl:call-template name="normalize-date">
              <xsl:with-param name="date" select="NotificationDate"/>
            </xsl:call-template>
          </CriticalDateValue>
        </xsl:if>

        <SquareArea>3.14E0</SquareArea>
       
        <SquareAreaUOM>
          <common:Code>SQFT</common:Code>
          <common:Description>SQFT</common:Description>
        </SquareAreaUOM>

        <xsl:if test="EffectiveDate">
          <EffectiveDate>
            <xsl:call-template name="normalize-date">
              <xsl:with-param name="date" select="EffectiveDate"/>
            </xsl:call-template>
          </EffectiveDate>
        </xsl:if>
       
        <xsl:if test="EventComment">
          <Comments>
            <xsl:value-of select="EventComment"/>
          </Comments>
        </xsl:if>
       
        <CriticalDateStatus>
          <common:Code>Active</common:Code>
          <common:Description>Active</common:Description>
        </CriticalDateStatus>
       
      </CriticalDateFields>
    </CriticalDates>

  </xsl:template>

  <xsl:template name="normalize-date">
    <xsl:param name="date"/>
    <xsl:value-of select="format-number(number(substring-after(substring-after($date, '/'), '/')), '0000')"/>
    <xsl:text>-</xsl:text>
    <xsl:value-of select="format-number(number(substring-before(substring-after($date, '/'), '/')), '00')"/>
    <xsl:text>-</xsl:text>
    <xsl:value-of select="format-number(number(substring-before($date, '/')), '00')"/>
    <xsl:text>T00:00:00Z</xsl:text>
  </xsl:template>
</xsl:stylesheet>



Here is my Input XML:

<batch>    
  <row>
    <LeaseID>10004</LeaseID>
    <EventSequenceNumber>4</EventSequenceNumber>
    <LeaseEventTypeID>4</LeaseEventTypeID>
    <EffectiveDate>15/03/2012</EffectiveDate>
    <EventComment>Notification Begin Date: 03/15/2011 At the end of the Lease, it may be extended for yearly periods by the Tenant to a maximum of 5 years. If the Tenant does not wish to extend the Lease, it must given written notice to the Landlord 2 months in advance of the end of the lease. If notice is not served, the Lease will renew automatically.</EventComment>
  </row>
</batch>


Any idea?
LVL 8
mani_saiAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mani_saiAuthor Commented:
Here is my XSD:

<?xml version="1.0" encoding="utf-8"?>
<!-- edited with XMLSpy v2013 rel. 2 sp2 (http://www.altova.com) by Amy Force (CB Richard Ellis Services, Inc) -->
<xs:schema xmlns="http://integration.cbre.com/schemas/gcs/leasecriticaldates/v1" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:common="http://integration.cbre.com/schemas/gcs/common/v1" targetNamespace="http://integration.cbre.com/schemas/gcs/leasecriticaldates/v1" elementFormDefault="qualified">
      <!--  LEASE CRITICAL DATES
      VERSION : V1
      INITIAL DATE:                               08/12/2013
      LAST UPDATED DATE:       08/12/2013      BY: AForce
      
      V1 - Amy Force - Initial version of the CIM Lease Critical Dates XSD (based on Leae v1.4) - minimum critical date information only

      -->
      <!-- Include -->
      <xs:import namespace="http://integration.cbre.com/schemas/gcs/common/v1" schemaLocation="integration.cbre.com.schemas.gcs.common.v1.xsd"/>
      <!-- XSD -->
      <xs:complexType name="CriticalDateFields">
            <xs:annotation>
                  <xs:documentation>Critical Date</xs:documentation>
            </xs:annotation>
            <xs:sequence>
                  <xs:element name="CriticalDateId" type="xs:int" minOccurs="0">
                        <xs:annotation>
                              <xs:documentation>The ID for this Critical Date (if available)</xs:documentation>
                        </xs:annotation>
                  </xs:element>
                  <xs:element name="CriticalDateType" type="common:Codes" nillable="true" minOccurs="1">
                        <xs:annotation>
                              <xs:documentation>Indicates the type of critical date</xs:documentation>
                        </xs:annotation>
                  </xs:element>
                  <xs:element name="CriticalDateValue" type="xs:dateTime" nillable="true">
                        <xs:annotation>
                              <xs:documentation>Based on the type of option, the critical date value should contain the date that the user wants to use to track this option as being completed on time against.  It might be the Action Date, Landlord Notice Date, or the Effective Date.</xs:documentation>
                        </xs:annotation>
                  </xs:element>
                  <xs:element name="SquareArea" type="xs:double">
                        <xs:annotation>
                              <xs:documentation>Lease Area (in unit of measure provided in 'Square Area Unit of Measure') </xs:documentation>
                        </xs:annotation>
                  </xs:element>
                  <xs:element name="SquareAreaUOM" type="common:Codes">
                        <xs:annotation>
                              <xs:documentation>The unit of measure for area indicated in the Square Area</xs:documentation>
                        </xs:annotation>
                  </xs:element>
                  <xs:element name="ActionDate" type="xs:dateTime" minOccurs="0">
                        <xs:annotation>
                              <xs:documentation>Date that the account team has specified that they want to have completed a decision on the option. Use ISO 8601 DateTime as standard [YYYY-MM-DDThh:mm:ss]</xs:documentation>
                        </xs:annotation>
                  </xs:element>
                  <xs:element name="EffectiveDate" type="xs:dateTime">
                        <xs:annotation>
                              <xs:documentation>The date that the option would come in to effect if actioned.  Also referred to as Date of Option or Effective Start Date.Use ISO 8601 DateTime as standard [YYYY-MM-DDThh:mm:ss]</xs:documentation>
                        </xs:annotation>
                  </xs:element>
                  <xs:element name="CompletedDate" type="xs:dateTime" minOccurs="0">
                        <xs:annotation>
                              <xs:documentation>Completed Date.  Use ISO 8601 DateTime as standard [YYYY-MM-DDThh:mm:ss]</xs:documentation>
                        </xs:annotation>
                  </xs:element>
                  <xs:element name="CurrentExpirationDate" type="xs:dateTime" minOccurs="0">
                        <xs:annotation>
                              <xs:documentation>Date of current lease expiration. Use ISO 8601 DateTime as standard [YYYY-MM-DDThh:mm:ss]</xs:documentation>
                        </xs:annotation>
                  </xs:element>
                  <xs:element name="LandlordNoticeDate" type="xs:dateTime" minOccurs="0">
                        <xs:annotation>
                              <xs:documentation>The last date to serve any notice required to trigger the option. Use ISO 8601 DateTime as standard [YYYY-MM-DDThh:mm:ss]</xs:documentation>
                        </xs:annotation>
                  </xs:element>
                  <xs:element name="OptionEndDate" type="xs:dateTime" minOccurs="0">
                        <xs:annotation>
                              <xs:documentation>The date the option would end e.g. the last day of a specific renewal period. Please enter the "Date of Option" date if the option is a one off event e.g. break option.  Also referred to as the Effective End Date, or Date Option ceases. Use ISO 8601 DateTime as standard [YYYY-MM-DDThh:mm:ss]</xs:documentation>
                        </xs:annotation>
                  </xs:element>
                  <xs:element name="NewEndDate" type="xs:dateTime" minOccurs="0">
                        <xs:annotation>
                              <xs:documentation>New expiration date (if the lease has been extended, etc). Use ISO 8601 DateTime as standard [YYYY-MM-DDThh:mm:ss]</xs:documentation>
                        </xs:annotation>
                  </xs:element>
                  <xs:element name="Comments" type="xs:string" minOccurs="0">
                        <xs:annotation>
                              <xs:documentation>A comment related to this Critical Date</xs:documentation>
                        </xs:annotation>
                  </xs:element>
                  <xs:element name="CriticalDateStatus" type="common:Codes" minOccurs="0">
                        <xs:annotation>
                              <xs:documentation>Indicates the current status of the critical date</xs:documentation>
                        </xs:annotation>
                  </xs:element>
            </xs:sequence>
      </xs:complexType>
      <xs:complexType name="LeaseDetails">
            <xs:annotation>
                  <xs:documentation>Details of the lease (non-financial)</xs:documentation>
            </xs:annotation>
            <xs:sequence>
                  <xs:element name="ClientId" type="xs:string" nillable="true">
                        <xs:annotation>
                              <xs:documentation>Unique Client identifier</xs:documentation>
                        </xs:annotation>
                  </xs:element>
                  <xs:element name="LeaseId" type="xs:string" nillable="true">
                        <xs:annotation>
                              <xs:documentation>Unique Lease ID used by the client as identification (this may or may not be the same as the system ID)</xs:documentation>
                        </xs:annotation>
                  </xs:element>
                  <xs:element name="CriticalDates" type="ArrayOfCriticalDates" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
      </xs:complexType>
      <xs:complexType name="ArrayOfCriticalDates">
            <xs:annotation>
                  <xs:documentation>List of Critical Dates</xs:documentation>
            </xs:annotation>
            <xs:sequence>
                  <xs:element name="CriticalDateFields" type="CriticalDateFields" minOccurs="0" maxOccurs="unbounded">
                        <xs:annotation>
                              <xs:documentation>Critical Dates associated with this lease</xs:documentation>
                        </xs:annotation>
                  </xs:element>
            </xs:sequence>
      </xs:complexType>
      <xs:element name="Lease" type="LeaseDetails" nillable="true"/>
</xs:schema>
0
Geert BormansInformation ArchitectCommented:
<CriticalDateValue> is mandatory in the schema
In the XSLT you have its creation wrapped in a xsl:if

               <xsl:if test="NotificationDate">
                    <CriticalDateValue>
                        <xsl:call-template name="normalize-date">
                            <xsl:with-param name="date" select="NotificationDate"/>
                        </xsl:call-template>
                    </CriticalDateValue>
                </xsl:if>

If there is no NotificationDate in your source, the result will be unvalid
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mani_saiAuthor Commented:
Thanks. That error went off..now another error...


Schema validation error at LineNumber: [1], LinePosition: [481], Message: [The 'http://integration.cbre.com/schemas/gcs/leasecriticaldates/v1:CriticalDateValue' element is invalid - The value 'NaN-NaN-NaNT00:00:00Z' is invalid according to its datatype 'http://www.w3.org/2001/XMLSchema:dateTime' - The string 'NaN-NaN-NaNT00:00:00Z' is not a valid DateTime value.], SourceSchemaObject: [], SourceUri: []


Schema validation error at LineNumber: [1], LinePosition: [1026], Message: [The 'http://integration.cbre.com/schemas/gcs/leasecriticaldates/v1:Comments' element is invalid - The value 'Notification Begin Date: 03/15/2011 At the end of the Lease, it may be extended for yearly periods by the Tenant to a maximum of 5 years. If the Tenant does not wish to extend the Lease, it must given written notice to the Landlord 2 months in advance of the end of the lease. If notice is not served, the Lease will renew automatically.' is invalid according to its datatype 'http://www.w3.org/2001/XMLSchema:dateTime' -




The string 'Notification Begin Date: 03/15/2011 At the end of the Lease, it may be extended for yearly periods by the Tenant to a maximum of 5 years. If the Tenant does not wish to extend the Lease, it must given written notice to the Landlord 2 months in advance of the end of the lease. If notice is not served, the Lease will renew automatically.' is not a valid DateTime value.], SourceSchemaObject: [], SourceUri: []



Here is my XSLT:

<?xml version="1.0" encoding="UTF-8"?>

<!--  Event Mapping (For Horizon to CIM)
          VERSION :           V1
          INITIAL DATE:                        08/14/2013
          LAST UPDATED DATE:       08/22/2013      
      Created By:         Mani
      -->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns="http://integration.cbre.com/schemas/gcs/leasecriticaldates/v1"
    xmlns:common="http://integration.cbre.com/schemas/gcs/common/v1"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"    
    version="1.0" >

  <xsl:output indent="yes"/>

  <xsl:template match="batch">
    <Lease xmlns="http://integration.cbre.com/schemas/gcs/leasecriticaldates/v1"
           xmlns:common="http://integration.cbre.com/schemas/gcs/common/v1"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <xsl:apply-templates select="row"/>
    </Lease>
  </xsl:template>

  <xsl:template match="row">
    <ClientId>HP</ClientId>
   
    <LeaseId>
      <xsl:value-of select="LeaseID"/>
    </LeaseId>
   
    <CriticalDates>
      <CriticalDateFields>
        <CriticalDateId>
          <xsl:value-of select="EventSequenceNumber"/>
        </CriticalDateId>
       
        <CriticalDateType>
          <common:Code>
            <xsl:value-of select="LeaseEventTypeID"/>
          </common:Code>
          <common:Description>
            <xsl:value-of select="LeaseEventTypeID"/>
          </common:Description>
        </CriticalDateType>
       
          <CriticalDateValue>
            <xsl:call-template name="normalize-date">
              <xsl:with-param name="date" select="NotificationDate"/>
            </xsl:call-template>
          </CriticalDateValue>      

        <SquareArea>0.00</SquareArea>
               
        <SquareAreaUOM>
          <common:Code>SQFT</common:Code>
          <common:Description>SQFT</common:Description>
        </SquareAreaUOM>

        <xsl:if test="EffectiveDate">
          <EffectiveDate>
            <xsl:call-template name="normalize-date">
              <xsl:with-param name="date" select="EffectiveDate"/>
            </xsl:call-template>
          </EffectiveDate>
        </xsl:if>
       
        <xsl:if test="EventComment">
          <Comments>
            <xsl:value-of select="EventComment"/>
          </Comments>
        </xsl:if>
       
        <CriticalDateStatus>
          <common:Code>Active</common:Code>
          <common:Description>Active</common:Description>
        </CriticalDateStatus>
       
      </CriticalDateFields>
    </CriticalDates>

  </xsl:template>

  <xsl:template name="normalize-date">
    <xsl:param name="date"/>
    <xsl:value-of select="format-number(number(substring-after(substring-after($date, '/'), '/')), '0000')"/>
    <xsl:text>-</xsl:text>
    <xsl:value-of select="format-number(number(substring-before(substring-after($date, '/'), '/')), '00')"/>
    <xsl:text>-</xsl:text>
    <xsl:value-of select="format-number(number(substring-before($date, '/')), '00')"/>
    <xsl:text>T00:00:00Z</xsl:text>
  </xsl:template>
</xsl:stylesheet>
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

mani_saiAuthor Commented:
Never mind:

Here is my Input XML:

<?xml version="1.0" encoding="utf-8"?>
<batch>
  <row>
    <LeaseID>10004</LeaseID>
    <EventSequenceNumber>3</EventSequenceNumber>
    <LeaseEventTypeID>3</LeaseEventTypeID>
    <NotificationDate>17/06/2010</NotificationDate>
    <EffectiveDate>15/07/2010</EffectiveDate>
    <EventComment>Tenant may termiante the Lease</EventComment>
  </row>
</batch>


error i am getting:

Schema validation error at LineNumber: [1], LinePosition: [718], Message: [The 'http://integration.cbre.com/schemas/gcs/leasecriticaldates/v1:Comments' element is invalid - The value 'Tenant may termiante the Lease' is invalid according to its datatype 'http://www.w3.org/2001/XMLSchema:dateTime' - The string 'Tenant may termiante the Lease' is not a valid DateTime value.], SourceSchemaObject: [], SourceUri: []


Any idea?
0
Geert BormansInformation ArchitectCommented:
Take them one at the time, the first one is obvious, your date normalization template is not working well and returning NaN instead of numbers, so you need to plug in one of the other date processing templates

The second is weird, since you seem to have changed the schema. It complains because the Comments is not dateTime... but my version of the schema says it should be xs:string
0
mani_saiAuthor Commented:
we found out the issue...

Schema conflict…Both Notification Date and Effective Date are mandatory fields on the schema…
0
Geert BormansInformation ArchitectCommented:
weird message in that case
0
mani_saiAuthor Commented:
Thanks
0
Geert BormansInformation ArchitectCommented:
welcome
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
XML

From novice to tech pro — start learning today.