XML - XSLT Error

I am getting this error:

Schema validation error at LineNumber: [1], LinePosition: [1305], Message: [The element 'Lease' in namespace 'http://integration.cbre.com/schemas/gcs/hp/horizonhplease/v1' has invalid child element 'LeaseContacts' in namespace


Here is my XSD:


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

<xs:schema xmlns="http://integration.cbre.com/schemas/gcs/hp/horizonhplease/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/hp/horizonhplease/v1" elementFormDefault="qualified">

      <!-- 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="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="SystemLeaseId" type="xs:string" nillable="true">
                        <xs:annotation>
                              <xs:documentation>The ID for this Lease record in the system of record</xs:documentation>
                        </xs:annotation>
                  </xs:element>
                  <xs:element name="MasterLeaseId" type="xs:string" minOccurs="0">
                        <xs:annotation>
                              <xs:documentation>Parent Lease ID (usually setup to relate leases such as a sublet to the master lease agreement) Should match an existing Lease ID</xs:documentation>
                        </xs:annotation>
                  </xs:element>
                  <xs:element name="ExternalLeaseId" type="xs:string" minOccurs="0">
                        <xs:annotation>
                              <xs:documentation>Lease ID as referenced by an external client system</xs:documentation>
                        </xs:annotation>
                  </xs:element>
                  <xs:element name="SystemLocationId" type="xs:string" minOccurs="0">
                        <xs:annotation>
                              <xs:documentation>System Identifier for the corresponding location</xs:documentation>
                        </xs:annotation>
                  </xs:element>
                  <xs:element name="LocationId" type="xs:string" nillable="true">
                        <xs:annotation>
                              <xs:documentation>Identifier of corresponding location (this should be the location ID used across all the client's systems</xs:documentation>
                        </xs:annotation>
                  </xs:element>
                  <xs:element name="LeaseName" type="xs:string" nillable="true">
                        <xs:annotation>
                              <xs:documentation>Name of this lease (typically either the address or the building name)</xs:documentation>
                        </xs:annotation>
                  </xs:element>
                  <xs:element name="LeaseAddress" type="common:Address" nillable="true" minOccurs="0" maxOccurs="1">
                        <xs:annotation>
                              <xs:documentation>Lease address. NOT REQUIRED FOR HORIZON HP</xs:documentation>
                        </xs:annotation>
                  </xs:element>
                  <xs:element name="LeaseRentableArea" type="xs:double">
                        <xs:annotation>
                              <xs:documentation>The (square footage) for which rent can be charged. Generally it is the gross area of the full floor less the area of all vertical penetrations (elevator shafts, stairwells, mechanical shafts etc.) Rentable area can be measured in many ways, but the most common measurement for office buildings is according to BOMA standards. </xs:documentation>
                        </xs:annotation>
                  </xs:element>
                  <xs:element name="GrossBuildingArea" type="xs:double" minOccurs="0">
                        <xs:annotation>
                              <xs:documentation>Gross building area</xs:documentation>
                        </xs:annotation>
                  </xs:element>
                  <xs:element name="LeaseAreaUOM" type="common:Codes">
                        <xs:annotation>
                              <xs:documentation>The unit of measure for area (i.e. SQFT)</xs:documentation>
                        </xs:annotation>
                  </xs:element>
                  <xs:element name="OriginalLeaseSignedDate" type="xs:dateTime" minOccurs="0">
                        <xs:annotation>
                              <xs:documentation>Original date the lease was signed.  Use ISO 8601 DateTime as standard [YYYY-MM-DDThh:mm:ss]</xs:documentation>
                        </xs:annotation>
                  </xs:element>
                  <xs:element name="LeaseCommencementDate" type="xs:dateTime" minOccurs="0">
                        <xs:annotation>
                              <xs:documentation>The starting date of the lease. Use ISO 8601 DateTime as standard [YYYY-MM-DDThh:mm:ss]</xs:documentation>
                        </xs:annotation>
                  </xs:element>
                  <xs:element name="LeaseExpirationDate" type="xs:dateTime" minOccurs="0">
                        <xs:annotation>
                              <xs:documentation>The end date of the lease. Use ISO 8601 DateTime as standard [YYYY-MM-DDThh:mm:ss]</xs:documentation>
                        </xs:annotation>
                  </xs:element>
                  <xs:element name="OwnershipType" type="common:Codes" nillable="true" minOccurs="0">
                        <xs:annotation>
                              <xs:documentation>Indicate the ownership of building (own vs lease).  NOT REQUIRED FOR HORIZON HP.</xs:documentation>
                        </xs:annotation>
                  </xs:element>
                  <xs:element name="LeaseType" type="common:Codes" nillable="true" minOccurs="0">
                        <xs:annotation>
                              <xs:documentation>Indicates the type of lease. NOT REQUIRED FOR HORIZON HP.</xs:documentation>
                        </xs:annotation>
                  </xs:element>
                  <xs:element name="LeaseClassification" type="common:Codes" nillable="true" minOccurs="1">
                        <xs:annotation>
                              <xs:documentation>Indicates the classification of the lease </xs:documentation>
                        </xs:annotation>
                  </xs:element>
                  <xs:element name="LeaseStatus" type="common:Codes" nillable="true" minOccurs="1">
                        <xs:annotation>
                              <xs:documentation>Indicates the status of the lease </xs:documentation>
                        </xs:annotation>
                  </xs:element>
                  <xs:element name="SpaceType" type="common:Codes" nillable="true" minOccurs="0">
                        <xs:annotation>
                              <xs:documentation>Indiates the type of space represented by the lease </xs:documentation>
                        </xs:annotation>
                  </xs:element>
                  <!-- Horizon/HP Specific Fields
                              DepositAmount      
                              DepositCurrencyId      
                              FinancialGuarantee
                              BankorParentGuarantee -->
                  <xs:element name="DepositAmount" type="xs:decimal" nillable="true" minOccurs="0">
                        <xs:annotation>
                              <xs:documentation>Deposit amount related to the lease</xs:documentation>
                        </xs:annotation>
                  </xs:element>
                  <xs:element name="DepositCurrencyCode" type="common:Codes" nillable="true" minOccurs="0">
                        <xs:annotation>
                              <xs:documentation>Indicates the currency code of the deposit </xs:documentation>
                        </xs:annotation>
                  </xs:element>
                  <xs:element name="FinancialGuarantee" type="xs:string" nillable="true" minOccurs="0">
                        <xs:annotation>
                              <xs:documentation>Indicates there is a Bank Guarantee or Corporate Guarantee (valid values are Y,N)</xs:documentation>
                        </xs:annotation>
                  </xs:element>
                  <xs:element name="BankorParentGuarantee" type="xs:string" nillable="true" minOccurs="0">
                        <xs:annotation>
                              <xs:documentation>Name of the guarantor for the bank/corporate guarantee</xs:documentation>
                        </xs:annotation>
                  </xs:element>
                  <xs:element name="ReportDate" type="xs:dateTime" nillable="true">
                        <xs:annotation>
                              <xs:documentation>Date the information is being reported</xs:documentation>
                        </xs:annotation>
                  </xs:element>
                  <xs:element name="LeaseContacts" type="common:ArrayOfContacts" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
      </xs:complexType>
      <xs:element name="Lease" type="LeaseDetails" nillable="true"/>
</xs:schema>


------------------------------------

XSLT:

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


<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns="http://integration.cbre.com/schemas/gcs/hp/horizonhplease/v1"
    xmlns:common="http://integration.cbre.com/schemas/gcs/common/v1"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt"
    xmlns:my="urn:sample"    
    version="1.0"
    xmlns:local="urn:local" extension-element-prefixes="msxsl">

  <msxsl:script language="CSharp" implements-prefix="local">
    public string dateTimeNow()
    {
    return DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ssZ");
    }
  </msxsl:script>


  <xsl:output indent="yes"/>

  <xsl:template match="horizon_feed">
    <Lease xmlns="http://integration.cbre.com/schemas/gcs/hp/horizonhplease/v1"
           xmlns:common="http://integration.cbre.com/schemas/gcs/common/v1"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           targetnamespace = "http://integration.cbre.com/schemas/gcs/hp/horizonhplease/v1" >
      <xsl:apply-templates select="lease"/>
    </Lease>
  </xsl:template>

  <xsl:template match="lease">
   
    <ClientId>HP</ClientId>
   
    <LeaseId>
      <xsl:value-of select="LeaseId"/>
    </LeaseId>
   
    <SystemLeaseId>
      <xsl:value-of select="LeaseId"/>
    </SystemLeaseId>

    <xsl:if test="ParentLeaseId">
      <MasterLeaseId>
        <xsl:value-of select="ParentLeaseId"/>
      </MasterLeaseId>
    </xsl:if>
   
    <LocationId>
      <xsl:value-of select="HPBuildingLandId"/>
    </LocationId>
   
    <LeaseName>
      <xsl:value-of select="LeaseName"/>
    </LeaseName>    
 
      <xsl:choose>
        <xsl:when test="RentableAreaAreas > 0">
          <LeaseRentableArea>
            <xsl:value-of select="RentableAreaAreas" />
          </LeaseRentableArea>
          <LeaseAreaUOM>
            <common:Code>Acres</common:Code>
            <common:Description>Acres</common:Description>
          </LeaseAreaUOM>
        </xsl:when>
        <xsl:when test="RentableAreaHectares > 0">
          <LeaseRentableArea>
            <xsl:value-of select="RentableAreaHectares" />
          </LeaseRentableArea>
          <LeaseAreaUOM>
            <common:Code>Hectares</common:Code>
            <common:Description>Hectares</common:Description>
          </LeaseAreaUOM>
        </xsl:when>
        <xsl:when test="RentableAreaSF > 0">
          <LeaseRentableArea>
            <xsl:value-of select="RentableAreaSF" />
          </LeaseRentableArea>
          <LeaseAreaUOM>
            <common:Code>SF</common:Code>
            <common:Description>SF</common:Description>
          </LeaseAreaUOM>
        </xsl:when>
        <xsl:when test="RentableAreaSQM > 0">
          <LeaseRentableArea>
            <xsl:value-of select="RentableAreaSQM" />
          </LeaseRentableArea>
          <LeaseAreaUOM>
            <common:Code>SQM</common:Code>
            <common:Description>SQM</common:Description>
          </LeaseAreaUOM>
        </xsl:when>
        <xsl:otherwise>
          <LeaseRentableArea>
            <xsl:value-of select="0" />
          </LeaseRentableArea>
          <LeaseAreaUOM>
            <common:Code>SF</common:Code>
            <common:Description>SF</common:Description>
          </LeaseAreaUOM>
        </xsl:otherwise>
      </xsl:choose>

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

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

    <LeaseClassification>
      <common:Code>
        <xsl:value-of select="LeaseCategoryID"/>
      </common:Code>
      <common:Description>
        <xsl:value-of select="LeaseCategoryID"/>
      </common:Description>
    </LeaseClassification>

    <LeaseStatus>
      <common:Code>
        <xsl:value-of select="LeaseStatusID"/>
      </common:Code>
      <common:Description>
        <xsl:value-of select="LeaseStatusID"/>
      </common:Description>
    </LeaseStatus>

    <xsl:if test="LeaseUseID">
      <SpaceType>
        <common:Code>
          <xsl:value-of select="LeaseUseID"/>
        </common:Code>
        <common:Description>
          <xsl:value-of select="LeaseUseID"/>
        </common:Description>
      </SpaceType>
    </xsl:if>

    <xsl:if test="DepositAmount">
      <DepositAmount>
        <xsl:value-of select="DepositAmount"/>
      </DepositAmount>
    </xsl:if>

    <xsl:if test="DepositCurrencyId">
      <DepositCurrencyCode>
        <common:Code>
          <xsl:value-of select="DepositCurrencyId"/>
        </common:Code>
        <common:Description>
          <xsl:value-of select="DepositCurrencyId"/>
        </common:Description>
      </DepositCurrencyCode>
    </xsl:if>

    <xsl:if test="FinancialGuarantee">
      <FinancialGuarantee>
        <xsl:value-of select="FinancialGuarantee"/>
      </FinancialGuarantee>
    </xsl:if>

    <xsl:if test="BankorParentGuarantee">
      <BankorParentGuarantee>
        <xsl:value-of select="BankorParentGuarantee"/>
      </BankorParentGuarantee>
    </xsl:if>

    <ReportDate>
      <xsl:value-of select="local:dateTimeNow()"/>
    </ReportDate>
   
    <LeaseContacts>

      <xsl:if test="LandlordName">
        <common:Contact>          
          <common:ContactRole>Landlord</common:ContactRole>
          <common:ContactName>
            <xsl:value-of select="LandlordName" />
          </common:ContactName>
        </common:Contact>        
      </xsl:if>

      <xsl:if test="TenantName">
      <common:Contact>
        <common:ContactRole>Tenant</common:ContactRole>
        <common:ContactName>
          <xsl:value-of select="TenantName" />
        </common:ContactName>
      </common:Contact>
      </xsl:if>

      <xsl:if test="HPLeaseManagerName">
      <common:Contact>
        <common:ContactRole>HPLeaseManager</common:ContactRole>
        <common:ContactName>
          <xsl:value-of select="HPLeaseManagerName" />
        </common:ContactName>
      </common:Contact>
      </xsl:if>          
     
    </LeaseContacts>

  </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>



---------------------------------------
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:
XSD for Common:

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

<xs:schema xmlns="http://integration.cbre.com/schemas/gcs/common/v1" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://integration.cbre.com/schemas/gcs/common/v1" elementFormDefault="qualified">
      <!--  COMMON
      VERSION : V1
      RELEASE DATE: 6/28/2013
      
      V1 - Initial version of the CIM Common XSD                

      -->
      <xs:complexType name="Audit">
            <xs:sequence>
                  <xs:element name="CreatedDate" type="xs:dateTime" minOccurs="0">
                        <xs:annotation>
                              <xs:documentation>Date record was created. Use ISO 8601 DateTime as standard [YYYY-MM-DDThh:mm:ss]</xs:documentation>
                        </xs:annotation>
                  </xs:element>
                  <xs:element name="CreatedBy" type="xs:string" nillable="true" minOccurs="0">
                        <xs:annotation>
                              <xs:documentation>User who created the record.</xs:documentation>
                        </xs:annotation>
                  </xs:element>
                  <xs:element name="UpdatedDate" type="xs:dateTime" minOccurs="0">
                        <xs:annotation>
                              <xs:documentation>Date record was updated. Use ISO 8601 DateTime as standard [YYYY-MM-DDThh:mm:ss]</xs:documentation>
                        </xs:annotation>
                  </xs:element>
                  <xs:element name="UpdatedBy" type="xs:string" nillable="true" minOccurs="0">
                        <xs:annotation>
                              <xs:documentation>User who last updated the record.</xs:documentation>
                        </xs:annotation>
                  </xs:element>
            </xs:sequence>
      </xs:complexType>
      <xs:complexType name="Codes">
            <xs:sequence>
                  <xs:element name="Code" type="xs:string" nillable="true">
                        <xs:annotation>
                              <xs:documentation>Code</xs:documentation>
                        </xs:annotation>
                  </xs:element>
                  <xs:element name="Description" type="xs:string" nillable="true">
                        <xs:annotation>
                              <xs:documentation>Description for the code</xs:documentation>
                        </xs:annotation>
                  </xs:element>
            </xs:sequence>
      </xs:complexType>
      <xs:complexType name="Contact">
            <xs:sequence>
                  <xs:element name="ContactRole" type="xs:string" nillable="true" minOccurs="0">
                        <xs:annotation>
                              <xs:documentation>Role of the contact</xs:documentation>
                        </xs:annotation>
                  </xs:element>
                  <xs:element name="ContactName" type="xs:string" nillable="true">
                        <xs:annotation>
                              <xs:documentation>Contact's full name</xs:documentation>
                        </xs:annotation>
                  </xs:element>
                  <xs:element name="ContactCompanyName" type="xs:string" nillable="true" minOccurs="0">
                        <xs:annotation>
                              <xs:documentation>Contact's company name</xs:documentation>
                        </xs:annotation>
                  </xs:element>
                  <xs:element name="PersonId" type="xs:string" nillable="true" minOccurs="0">
                        <xs:annotation>
                              <xs:documentation>Unique identifier assigned to this contact in source system</xs:documentation>
                        </xs:annotation>
                  </xs:element>
                  <xs:element name="ContactPhone" type="Phone" nillable="true" minOccurs="0">
                        <xs:annotation>
                              <xs:documentation>Contact's phone number(s)</xs:documentation>
                        </xs:annotation>
                  </xs:element>
                  <xs:element name="ContactEmail" type="xs:string" nillable="true" minOccurs="0">
                        <xs:annotation>
                              <xs:documentation>Contact's email address</xs:documentation>
                        </xs:annotation>
                  </xs:element>
                  <xs:element name="ContactAddress" type="Address" nillable="true" minOccurs="0">
                        <xs:annotation>
                              <xs:documentation>Contact's addresses</xs:documentation>
                        </xs:annotation>
                  </xs:element>
            </xs:sequence>
      </xs:complexType>
      <xs:complexType name="ArrayOfContacts">
            <xs:sequence>
                  <xs:element name="Contact" type="Contact" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
      </xs:complexType>
      <xs:complexType name="Address">
            <xs:sequence>
                  <xs:element name="AddressType" type="xs:string" nillable="true">
                        <xs:annotation>
                              <xs:documentation>Indicates the type of address (remittance, mailing, etc)</xs:documentation>
                        </xs:annotation>
                  </xs:element>
                  <xs:element name="AddressLine1" type="xs:string" nillable="true">
                        <xs:annotation>
                              <xs:documentation>Address Line 1</xs:documentation>
                        </xs:annotation>
                  </xs:element>
                  <xs:element name="AddressLine2" type="xs:string" nillable="true" minOccurs="0">
                        <xs:annotation>
                              <xs:documentation>Address Line 2 (optional)</xs:documentation>
                        </xs:annotation>
                  </xs:element>
                  <xs:element name="AddressLine3" type="xs:string" nillable="true" minOccurs="0">
                        <xs:annotation>
                              <xs:documentation>Address Line 3 (optional)</xs:documentation>
                        </xs:annotation>
                  </xs:element>
                  <xs:element name="AddressLine4" type="xs:string" nillable="true" minOccurs="0">
                        <xs:annotation>
                              <xs:documentation>Address Line 4 (optional)</xs:documentation>
                        </xs:annotation>
                  </xs:element>
                  <xs:element name="City" type="xs:string" nillable="true">
                        <xs:annotation>
                              <xs:documentation>City for the address</xs:documentation>
                        </xs:annotation>
                  </xs:element>
                  <xs:element name="StateProvince" type="Codes" nillable="true">
                        <xs:annotation>
                              <xs:documentation>State or Province for the address</xs:documentation>
                        </xs:annotation>
                  </xs:element>
                  <xs:element name="ZipPostalCode" type="xs:string" nillable="true" minOccurs="0">
                        <xs:annotation>
                              <xs:documentation>Postal Code</xs:documentation>
                        </xs:annotation>
                  </xs:element>
                  <xs:element name="County" type="xs:string" nillable="true" minOccurs="0">
                        <xs:annotation>
                              <xs:documentation>County for the address</xs:documentation>
                        </xs:annotation>
                  </xs:element>
                  <xs:element name="Country" type="Codes" nillable="true">
                        <xs:annotation>
                              <xs:documentation>Country for the address. Use ISO 3166-1 alpha-3 Country Codes as a Standard.</xs:documentation>
                        </xs:annotation>
                  </xs:element>
            </xs:sequence>
      </xs:complexType>
      <xs:complexType name="ArrayOfAddresses">
            <xs:sequence>
                  <xs:element name="Address" type="Address" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
      </xs:complexType>
      <xs:complexType name="Phone">
            <xs:sequence>
                  <xs:element name="PhoneType" type="xs:string" nillable="true"/>
                  <xs:element name="CountryAreaCode" type="xs:string" nillable="true"/>
                  <xs:element name="PhoneNumber" type="xs:string" nillable="true"/>
            </xs:sequence>
      </xs:complexType>
      <xs:complexType name="ArrayOfPhones">
            <xs:sequence>
                  <xs:element name="Phone" type="Phone" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
      </xs:complexType>
</xs:schema>
0
Geert BormansInformation ArchitectCommented:
Is that when you run the XSLT or when you validate the result afterwards.

The schema also has an imported schem, you should pass that too.

It seems your source XML simply is invalid. Can you send the source XML you are working with, so I can set up a test harnass?
0
mani_saiAuthor Commented:
Source XML:

<?xml version="1.0" encoding="utf-8"?>
<horizon_feed>
  <lease>
    <LeaseId>10141</LeaseId>
    <LeaseCategoryID>1</LeaseCategoryID>
    <LeaseStatusID>1</LeaseStatusID>
    <LeaseUseID>2</LeaseUseID>
    <HPBuildingLandId>BEM01</HPBuildingLandId>
    <ParentLeaseId>10141</ParentLeaseId>
    <LeaseName>Mechelen Business Tower</LeaseName>
    <Commence>01/04/2001</Commence>
    <Expiration>31/03/2016</Expiration>
    <TenantName>Hill International (UK) Limited</TenantName>
    <LandlordName>Intervest Offices and Warehouses</LandlordName>
    <HPLeaseManagerName>Robert Barr</HPLeaseManagerName>
    <RentableAreaAreas>0</RentableAreaAreas>
    <RentableAreaHectares>0</RentableAreaHectares>
    <RentableAreaSF>10000026</RentableAreaSF>
    <RentableAreaSQM>0</RentableAreaSQM>
    <DepositAmount>974003.53</DepositAmount>
    <DepositCurrencyId>EUR</DepositCurrencyId>
    <FinancialGuarantee>Y</FinancialGuarantee>
    <BankorParentGuarantee>Unknown</BankorParentGuarantee>
    <LeaseComment>Y</LeaseComment>
  </lease>
</horizon_feed>




When i test locally using visual Studio, it works fine....

Output XML looks like this:

<?xml version="1.0" encoding="utf-8"?>
<Lease targetnamespace="http://integration.cbre.com/schemas/gcs/hp/horizonhplease/v1"
       xmlns="http://integration.cbre.com/schemas/gcs/hp/horizonhplease/v1"
       xmlns:common="http://integration.cbre.com/schemas/gcs/common/v1"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:my="urn:sample" xmlns:local="urn:local">
  <ClientId>HP</ClientId>
  <LeaseId>10141</LeaseId>
  <SystemLeaseId>10141</SystemLeaseId>
  <MasterLeaseId>10141</MasterLeaseId>
  <LocationId>BEM01</LocationId>
  <LeaseName>Mechelen Business Tower</LeaseName>
  <LeaseRentableArea>10000026</LeaseRentableArea>
  <LeaseAreaUOM>
    <common:Code>SF</common:Code>
    <common:Description>SF</common:Description>
  </LeaseAreaUOM>
  <LeaseCommencementDate>2001-04-01T00:00:00Z</LeaseCommencementDate>
  <LeaseExpirationDate>2016-03-31T00:00:00Z</LeaseExpirationDate>
  <LeaseClassification>
    <common:Code>1</common:Code>
    <common:Description>1</common:Description>
  </LeaseClassification>
  <LeaseStatus>
    <common:Code>1</common:Code>
    <common:Description>1</common:Description>
  </LeaseStatus>
  <SpaceType>
    <common:Code>2</common:Code>
    <common:Description>2</common:Description>
  </SpaceType>
  <DepositAmount>974003.53</DepositAmount>
  <DepositCurrencyCode>
    <common:Code>EUR</common:Code>
    <common:Description>EUR</common:Description>
  </DepositCurrencyCode>
  <FinancialGuarantee>Y</FinancialGuarantee>
  <BankorParentGuarantee>Unknown</BankorParentGuarantee>
  <ReportDate>2013-08-26T16:02:33Z</ReportDate>
  <LeaseContacts>
    <common:Contact>
      <common:ContactRole>Landlord</common:ContactRole>
      <common:ContactName>Intervest Offices and Warehouses</common:ContactName>
    </common:Contact>
    <common:Contact>
      <common:ContactRole>Tenant</common:ContactRole>
      <common:ContactName>Hill International (UK) Limited</common:ContactName>
    </common:Contact>
    <common:Contact>
      <common:ContactRole>HPLeaseManager</common:ContactRole>
      <common:ContactName>Robert Barr</common:ContactName>
    </common:Contact>
  </LeaseContacts>
</Lease>

----------------------------\

when we run in FTE integration tool...we are getting that error...
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:
also one more error:

Exception Type:PipelineActivityException
Source:Itp.Core
Message:Schema validation error at LineNumber: [1], LinePosition: [8], Message: [The 'targetnamespace' attribute is not declared.], SourceSchemaObject: [], SourceUri: []
0
Geert BormansInformation ArchitectCommented:
That is the first error I get,
you have an targetNamespace attribute in your output that is not declared
0
Geert BormansInformation ArchitectCommented:
replace this line

targetnamespace = "http://integration.cbre.com/schemas/gcs/hp/horizonhplease/v1" >

with a simple

>

and it validates
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
Geert BormansInformation ArchitectCommented:
targetNamespace is an xml schema term

if you want to reference the schema from your XML,
you will need something like this

 xsi:schemaLocation="http://integration.cbre.com/schemas/gcs/hp/horizonhplease/v1 LeaseDetails.xsd"

that attribute takes a double value
- before the whitespace, the namespace uri of the target namespace of your schema
- after the whitespace a physical reference to the schema, eg. the URL of the schema on a server of the file uri of the schema on disk
0
mani_saiAuthor Commented:
Do we need to remove the target namespace from XSLT?

 <Lease xmlns="http://integration.cbre.com/schemas/gcs/hp/horizonhplease/v1"
           xmlns:common="http://integration.cbre.com/schemas/gcs/common/v1"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          targetnamespace = "http://integration.cbre.com/schemas/gcs/hp/horizonhplease/v1>
      <xsl:apply-templates select="lease"/>
    </Lease>

like this:

<Lease xmlns="http://integration.cbre.com/schemas/gcs/hp/horizonhplease/v1"
           xmlns:common="http://integration.cbre.com/schemas/gcs/common/v1"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          >
      <xsl:apply-templates select="lease"/>
    </Lease>


Am i right?

Thanks
0
Geert BormansInformation ArchitectCommented:
Yes
0
mani_saiAuthor Commented:
Thanks.

Is the schema location optional or mandatory?



xsi:schemaLocation="http://integration.cbre.com/schemas/gcs/hp/horizonhplease/v1 LeaseDetails.xsd"
0
Geert BormansInformation ArchitectCommented:
You can add the xsi:schemalocation if you want
or let the integration find the schema, as you please

Funny:
<LeaseName>Mechelen Business Tower</LeaseName>

That one is less then 15km from where I live ,
I have worked for years on a walking distance from that building :-)
0
Geert BormansInformation ArchitectCommented:
If you don't have a URL for the physical schema,
you should not hardcode it in the XSLT actually

Too much hassle if you move the result files to a different location then
0
mani_saiAuthor Commented:
after removing targetnamespace, i am getting this output locally...

<?xml version="1.0" encoding="utf-8"?>
<Lease xmlns="http://integration.cbre.com/schemas/gcs/hp/horizonhplease/v1"
       xmlns:common="http://integration.cbre.com/schemas/gcs/common/v1"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:my="urn:sample" xmlns:local="urn:local">
  <ClientId>HP</ClientId>
  <LeaseId>10141</LeaseId>
  <SystemLeaseId>10141</SystemLeaseId>
  <MasterLeaseId>10141</MasterLeaseId>
  <LocationId>BEM01</LocationId>
  <LeaseName>Mechelen Business Tower</LeaseName>
  <LeaseRentableArea>10000026</LeaseRentableArea>
  <LeaseAreaUOM>
    <common:Code>SF</common:Code>
    <common:Description>SF</common:Description>
  </LeaseAreaUOM>
  <LeaseCommencementDate>2001-04-01T00:00:00Z</LeaseCommencementDate>
  <LeaseExpirationDate>2016-03-31T00:00:00Z</LeaseExpirationDate>
  <LeaseClassification>
    <common:Code>1</common:Code>
    <common:Description>1</common:Description>
  </LeaseClassification>
  <LeaseStatus>
    <common:Code>1</common:Code>
    <common:Description>1</common:Description>
  </LeaseStatus>
  <SpaceType>
    <common:Code>2</common:Code>
    <common:Description>2</common:Description>
  </SpaceType>
  <DepositAmount>974003.53</DepositAmount>
  <DepositCurrencyCode>
    <common:Code>EUR</common:Code>
    <common:Description>EUR</common:Description>
  </DepositCurrencyCode>
  <FinancialGuarantee>Y</FinancialGuarantee>
  <BankorParentGuarantee>Unknown</BankorParentGuarantee>
  <ReportDate>2013-08-27T09:32:45Z</ReportDate>
  <LeaseContacts>
    <common:Contact>
      <common:ContactRole>Landlord</common:ContactRole>
      <common:ContactName>Intervest Offices and Warehouses</common:ContactName>
    </common:Contact>
    <common:Contact>
      <common:ContactRole>Tenant</common:ContactRole>
      <common:ContactName>Hill International (UK) Limited</common:ContactName>
    </common:Contact>
    <common:Contact>
      <common:ContactRole>HPLeaseManager</common:ContactRole>
      <common:ContactName>Robert Barr</common:ContactName>
    </common:Contact>
  </LeaseContacts>
</Lease>


do it looks right for you?

Thanks
0
Geert BormansInformation ArchitectCommented:
That one validates, so that is good

I would however add this to the stylesheet element

    exclude-result-prefixes="my local msxsl"

that keeps the stylesheet internale namespace nodes out of the result... looks nicer
0
mani_saiAuthor Commented:
Added as per your suggestion...

Now it looks like this:


<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns="http://integration.cbre.com/schemas/gcs/hp/horizonhplease/v1"
    xmlns:common="http://integration.cbre.com/schemas/gcs/common/v1"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt"
    xmlns:my="urn:sample"    
    version="1.0"
    xmlns:local="urn:local"
    extension-element-prefixes="msxsl"
    exclude-result-prefixes="my local msxsl" >

  <msxsl:script language="CSharp" implements-prefix="local">
    public string dateTimeNow()
    {
    return DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ssZ");
    }
  </msxsl:script>


  <xsl:output indent="yes"/>

  <xsl:template match="horizon_feed">
    <Lease xmlns="http://integration.cbre.com/schemas/gcs/hp/horizonhplease/v1"
           xmlns:common="http://integration.cbre.com/schemas/gcs/common/v1"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
      <xsl:apply-templates select="lease"/>
    </Lease>
  </xsl:template>
0
Geert BormansInformation ArchitectCommented:
looks good
0
mani_saiAuthor Commented:
i am using visual studio, which does not give errors..

any good developmant tools you recommend for validating XML aganist schemas...

Thanks
0
Geert BormansInformation ArchitectCommented:
Number 1 development tool for XML, XSLT and XML schema
www.oxygenxml.com
it is not only very feature complete, it is also updated a lot, so it is always on top of current developments (it has already good support for schema 1.1 eg.)
it beats visual studio by a factor
0
mani_saiAuthor Commented:
Thanks
0
mani_saiAuthor Commented:
Crazy error:

===============Exception Details Begin===============
Exception Type:XslTransformException
Source:System.Xml.Xsl.CompiledQuery.1
Message:Execution of scripts was prohibited. Use the XsltSettings.EnableScript property to enable it. An error occurred at (187,7).
Stack Tarce:   at <xsl:template name="compiler:generated">(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator {urn:schemas-microsoft-com:xslt-debug}current)
   at <xsl:template match="horizon_feed">(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator {urn:schemas-microsoft-com:xslt-debug}current)
   at <xsl:apply-templates>(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator )
   at Root(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)
   at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter writer)
   at System.Xml.Xsl.XslCompiledTransform.Transform(XmlReader input, XmlWriter results)
   at Itp.Core.Common.XmlAccessor.TransformXml(XslCompiledTransform compiledTransform, XmlReader xmlReader) in c:\a\src\Core\Itp.Framework\Common\XmlAccessor.cs:line 203
   at Itp.Core.Common.XmlAccessor.TransformXml(XslCompiledTransform compiledTransform, String inputMessage) in c:\a\src\Core\Itp.Framework\Common\XmlAccessor.cs:line 162
   at Itp.Core.Integration.Activities.XslTransformActivity.ExecuteActivity(CodeActivityContext context, IntegrationManager integrationManager, IntegrationMessage& integrationMessage, String integrationPipelineKey) in c:\a\src\Core\Itp.Framework\Integration\Activities\XslTransformActivity.cs:line 136
===============Exception Details End===============


any idea?
0
Geert BormansInformation ArchitectCommented:
yes, you are using an extension function
so you have to enable the script functionality

Are you calling this from C#?

http://msdn.microsoft.com/en-us/library/system.xml.xsl.xsltsettings.enablescript.aspx
0
mani_saiAuthor Commented:
Thanks for all your help.
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.