XSL assistance / guidance request - PLEASE!!

Discussion in 'XML' started by Jimmy, Oct 15, 2004.

  1. Jimmy

    Jimmy Guest

    Hi,

    I have a (multi-tier) XML document and a XSL transform file (that is
    meant to transform the XML into a flat structure so I can insert the
    data into a database table).

    I have reached a problem node when doing a search for a match. The
    following works:

    <xsl:template match="PlanningPortalXML/pp:planningApplication/pa1:form">

    but when I try to read the next node (Context), the transform is
    failing (I am using Cooktop v2.5 for testing the transformation). I
    am a newbie so please bear with me. I have tried researched but have
    now hit a brick wall as I cannot progress.

    I would be grateful if someone could tell me where I am going worng.
    I only need to know why the Context node cannot be read. I have tried
    each of the namespace prefixes that are declared but to no success
    (meaning this may not be the cause). Once I know how to read the
    Context node, I will fugure out how to read any other node I want.

    The XML doc is as follows:

    <?xml version="1.0" encoding="utf-8"?>
    <DGPPPlanningApplication1_0>
    <SubID>1707</SubID>
    <APPNO></APPNO>
    <RefNum>1707</RefNum>
    <FormattedRefNum>PP-00001707</FormattedRefNum>
    <DateSubmittedToPortal>15/10/2004 14:27:20</DateSubmittedToPortal>
    <Description>PPPlanningApplication</Description>
    <PlanningPortalXML><PlanningApplication
    xmlns="http://www.planningportal.gov.uk/schema/XForm/Proposal-2003">
    <FeeDue xmlns="http://www.planningportal.gov.uk/schema/XForm-2003">0.00</FeeDue>
    <form:form xmlns:form="http://www.planningportal.gov.uk/schema/XForm/PlanningApp1-2003"
    version="2.0" xmlns="http://www.planningportal.gov.uk/schema/XForm-2003"
    xmlns:apd="http://www.govtalk.gov.uk/people/AddressAndPersonalDetails"
    xmlns:bs7666="http://www.govtalk.gov.uk/people/bs7666"
    xmlns:pType="http://www.govtalk.gov.uk/planning/PINSTypes-2003"
    xmlns:pins="http://www.planningportal.gov.uk/schema/XForm-2003"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.planningportal.gov.uk/schema/XForm/PlanningApp1-2003
    planningapplication-v2-0.xsd">
    <Context>
    <ProcessId>PlanningApplication1</ProcessId>
    <Activity/>
    <Valid>false</Valid>
    <NextActivity/>
    <PortalRefNo>PP-00001707</PortalRefNo>
    <LpaName>Halton Borough Council</LpaName>
    <LpaImageUrl>http:///cmimages/halton.gif</LpaImageUrl>
    <IsAgent>false</IsAgent>
    <PA2Selected>true</PA2Selected>
    </Context>
    <ApplicantAddress>
    <Name>
    <pType:OrgName>Resolution LTD</pType:OrgName>
    <PersonName>
    <pType:personTitle>Mr</pType:personTitle>
    <pType:FirstName>Simon</pType:FirstName>
    <pType:LastName>Townsend</pType:LastName>
    </PersonName>
    </Name>
    <ContactDetails PreferredContactMedium="Post">
    <pType:Availability/>
    <pType:ExternalAddress>
    <bs7666:SAON/>
    <bs7666:pAON>Churchill House</bs7666:pAON>
    <bs7666:StreetDescription>Churchill
    Road</bs7666:StreetDescription>
    <bs7666:Locality/>
    <bs7666:Town>Cheltenham</bs7666:Town>
    <bs7666:AdministrativeArea/>
    <bs7666:postTown/>
    <bs7666:postCode>Gl537EG</bs7666:postCode>
    </pType:ExternalAddress>
    <pType:EmailTelephoneFax>
    <apd:Email>
    <apd:EmailAddress/>
    </apd:Email>
    <apd:Telephone TelMobile="no" TelPreferred="yes" TelUse="work">
    <apd:TelNationalNumber/>
    <apd:TelExtensionNumber/>
    <apd:TelCountryCode/>
    </apd:Telephone>
    <apd:Fax FaxMobile="no" FaxPreferred="no" FaxUse="work">
    <apd:FaxNationalNumber/>
    <apd:FaxExtensionNumber/>
    <apd:FaxCountryCode/>
    </apd:Fax>
    </pType:EmailTelephoneFax>
    </ContactDetails>
    <DayTimeTelNo>
    <apd:TelNationalNumber/>
    <apd:TelExtensionNumber/>
    <apd:TelCountryCode/>
    </DayTimeTelNo>
    <DXNumber/>
    </ApplicantAddress>
    <AgentAddress>
    <Name>
    <pType:OrgName/>
    <PersonName>
    <pType:personTitle/>
    <pType:FirstName/>
    <pType:LastName/>
    </PersonName>
    </Name>
    <ContactDetails PreferredContactMedium="Post">
    <pType:Availability/>
    <pType:ExternalAddress>
    <bs7666:SAON/>
    <bs7666:pAON/>
    <bs7666:StreetDescription/>
    <bs7666:Locality/>
    <bs7666:Town/>
    <bs7666:AdministrativeArea/>
    <bs7666:postTown/>
    <bs7666:postCode/>
    </pType:ExternalAddress>
    <pType:EmailTelephoneFax>
    <apd:Email>
    <apd:EmailAddress/>
    </apd:Email>
    <apd:Telephone TelMobile="no" TelPreferred="yes" TelUse="work">
    <apd:TelNationalNumber/>
    <apd:TelExtensionNumber/>
    <apd:TelCountryCode/>
    </apd:Telephone>
    <apd:Fax FaxMobile="no" FaxPreferred="no" FaxUse="work">
    <apd:FaxNationalNumber/>
    <apd:FaxExtensionNumber/>
    <apd:FaxCountryCode/>
    </apd:Fax>
    </pType:EmailTelephoneFax>
    </ContactDetails>
    <DayTimeTelNo>
    <apd:TelNationalNumber/>
    <apd:TelExtensionNumber/>
    <apd:TelCountryCode/>
    </DayTimeTelNo>
    <DXNumber/>
    </AgentAddress>
    <SiteLocation>
    <SameAsApplicant>false</SameAsApplicant>
    <pType:ExternalAddress>
    <bs7666:SAON>BLOCK A &amp; B</bs7666:SAON>
    <bs7666:pAON>GROSVENOR HOUSE</bs7666:pAON>
    <bs7666:StreetDescription>HALTON LEA</bs7666:StreetDescription>
    <bs7666:Locality/>
    <bs7666:Town>RUNCORN</bs7666:Town>
    <bs7666:AdministrativeArea>CHESHIRE</bs7666:AdministrativeArea>
    <bs7666:postTown/>
    <bs7666:postCode>WA7 2GW</bs7666:postCode>
    </pType:ExternalAddress>
    <uprn>00</uprn>
    <OtherLocation/>
    </SiteLocation>
    <ProposalDescription>
    <Description> im going to build a large sign
    to advertise.....pudding</Description>
    </ProposalDescription>
    <TypeOfApplication>
    <Type>FULL</Type>
    <ReservedMatters>
    <Siting>false</Siting>
    <Design>false</Design>
    <ExternalAppearance>false</ExternalAppearance>
    <MeansOfAccess>false</MeansOfAccess>
    <Landscaping>false</Landscaping>
    </ReservedMatters>
    <ExistingRefNo/>
    <PreviousDecisionDate/>
    <ConditionNo/>
    <ProposalType>
    <NewBuilding>false</NewBuilding>
    <AlterBuilding>false</AlterBuilding>
    <ChangeUse>false</ChangeUse>
    <Demolition>true</Demolition>
    <OtherOperation>false</OtherOperation>
    </ProposalType>
    </TypeOfApplication>
    <Access>
    <AccessAffected>
    <Pedestrian>false</Pedestrian>
    <Vehicular>false</Vehicular>
    </AccessAffected>
    <AccessProposed>
    <Pedestrian>false</Pedestrian>
    <Vehicular>false</Vehicular>
    </AccessProposed>
    <DisabilityAccess/>
    </Access>
    <OtherInformation>
    <Disabilities>false</Disabilities>
    <AddPlant>false</AddPlant>
    <RemovePlant>false</RemovePlant>
    <StoreRefuse>false</StoreRefuse>
    </OtherInformation>
    <Materials>
    <Walls/>
    <Roof/>
    <Boundaries/>
    </Materials>
    <SiteArea>
    <ExistingFloorspace>0</ExistingFloorspace>
    <ProposedFloorspace>0</ProposedFloorspace>
    <SiteAreaValues>0</SiteAreaValues>
    <Units>sq.metres</Units>
    <FrontageSize>0</FrontageSize>
    <NewBuildingWork>true</NewBuildingWork>
    <SiteAreaChangeofUse>true</SiteAreaChangeofUse>
    <ChangeUseFloorspace>0</ChangeUseFloorspace>
    <RemoveBuildingPart>true</RemoveBuildingPart>
    <Plan>
    <Description/>
    </Plan>
    </SiteArea>
    <PublicRightOfWay>
    <IsAltering>false</IsAltering>
    <IsAdjacent>false</IsAdjacent>
    <Plan>
    <Description/>
    <Number/>
    </Plan>
    </PublicRightOfWay>
    <ExistingUses>
    <CurrentUse/>
    <PreviousUse/>
    </ExistingUses>
    <ResidentialInformation>
    <HasResidentialUnitChanged>true</HasResidentialUnitChanged>
    <ResidentialUnitChanges>
    <House>
    <Existing>0</Existing>
    <Proposed>0</Proposed>
    <Net>0</Net>
    </House>
    <Flat>
    <Existing>0</Existing>
    <Proposed>0</Proposed>
    <Net>0</Net>
    </Flat>
    <Bedsit>
    <Existing>0</Existing>
    <Proposed>0</Proposed>
    <Net>0</Net>
    </Bedsit>
    <Other>
    <Existing>0</Existing>
    <Proposed>0</Proposed>
    <Net>0</Net>
    <OtherType>Other</OtherType>
    </Other>
    </ResidentialUnitChanges>
    <LandType>Brownfield</LandType>
    </ResidentialInformation>
    <Height>
    <PropHeight>0</PropHeight>
    </Height>
    <Details>
    <RetroApplication>false</RetroApplication>
    <ApplicationFor>
    <Industry>false</Industry>
    <Office>false</Office>
    <Warehousing>false</Warehousing>
    <Storage>false</Storage>
    <Shopping>false</Shopping>
    <GeneralCommerical>false</GeneralCommerical>
    </ApplicationFor>
    </Details>
    <Interest>
    <ApplicantInterest>Owner</ApplicantInterest>
    <OtherDetails/>
    <OwnAdjoining>false</OwnAdjoining>
    <CouncilOwned>false</CouncilOwned>
    </Interest>
    <Parking>
    <Cars>
    <Existing>0</Existing>
    <New>0</New>
    <Total>0</Total>
    </Cars>
    <GoodsVehicle>
    <Existing>0</Existing>
    <New>0</New>
    <Total>0</Total>
    </GoodsVehicle>
    <MotorCycle>
    <Existing>0</Existing>
    <New>0</New>
    <Total>0</Total>
    </MotorCycle>
    <Disability>
    <Existing>0</Existing>
    <New>0</New>
    <Total>0</Total>
    </Disability>
    </Parking>
    <Drainage>
    <SurfaceWater/>
    <FoulSewage/>
    <SepticTankGroundInvestigated>false</SepticTankGroundInvestigated>
    </Drainage>
    <PreviousApplications>
    <AnyPreviousApplications>true</AnyPreviousApplications>
    <DocRef>
    <RefNo/>
    <AppDate/>
    </DocRef>
    </PreviousApplications>
    <IndustrialUse>
    <ProcessesAndProducts/>
    <Machinery/>
    </IndustrialUse>
    <RelatedDevelopment>
    <ExistingUseNearby>false</ExistingUseNearby>
    <ExistingUseNearbyDetails/>
    <LargerScheme>false</LargerScheme>
    <LargerSchemeDetails/>
    </RelatedDevelopment>
    <Floorspace>
    <FloorspaceChanges>
    <Shop>
    <Existing>0</Existing>
    <ToDemolish>0</ToDemolish>
    <Proposed>0</Proposed>
    <Total>0</Total>
    </Shop>
    <ProfessionalFinancial>
    <Existing>0</Existing>
    <ToDemolish>0</ToDemolish>
    <Proposed>0</Proposed>
    <Total>0</Total>
    </ProfessionalFinancial>
    <Restaurant>
    <Existing>0</Existing>
    <ToDemolish>0</ToDemolish>
    <Proposed>0</Proposed>
    <Total>0</Total>
    </Restaurant>
    <Office>
    <Existing>0</Existing>
    <ToDemolish>0</ToDemolish>
    <Proposed>0</Proposed>
    <Total>0</Total>
    </Office>
    <Industrial>
    <Existing>0</Existing>
    <ToDemolish>0</ToDemolish>
    <Proposed>0</Proposed>
    <Total>0</Total>
    </Industrial>
    <Warehouse>
    <Existing>0</Existing>
    <ToDemolish>0</ToDemolish>
    <Proposed>0</Proposed>
    <Total>0</Total>
    </Warehouse>
    <Hotel>
    <Existing>0</Existing>
    <ToDemolish>0</ToDemolish>
    <Proposed>0</Proposed>
    <Total>0</Total>
    </Hotel>
    <Other>
    <Existing>0</Existing>
    <ToDemolish>0</ToDemolish>
    <Proposed>0</Proposed>
    <Total>0</Total>
    <OtherType>Other</OtherType>
    </Other>
    <Total>
    <Existing>0</Existing>
    <ToDemolish>0</ToDemolish>
    <Proposed>0</Proposed>
    <Total>0</Total>
    </Total>
    </FloorspaceChanges>
    </Floorspace>
    <Employment>
    <EmploymentChanges>
    <Existing>
    <FullTime>0</FullTime>
    <PartTime>0</PartTime>
    <Total>0</Total>
    </Existing>
    <Proposed>
    <FullTime>0</FullTime>
    <PartTime>0</PartTime>
    <Total>0</Total>
    </Proposed>
    <Total>
    <FullTime>0</FullTime>
    <PartTime>0</PartTime>
    <Total>0</Total>
    </Total>
    </EmploymentChanges>
    </Employment>
    <TrafficFlow>
    <TrafficFlowChanges>
    <Car>
    <Existing>0</Existing>
    <New>0</New>
    <Total>0</Total>
    </Car>
    <HGV>
    <Existing>0</Existing>
    <New>0</New>
    <Total>0</Total>
    </HGV>
    <Other>
    <Existing>0</Existing>
    <New>0</New>
    <Total>0</Total>
    </Other>
    </TrafficFlowChanges>
    </TrafficFlow>
    <Servicing>
    <VehicleProvision/>
    </Servicing>
    <HoursOfWork>
    <Working>
    <Mon>
    <Existing>
    <StartTime/>
    <StopTime/>
    </Existing>
    <Proposed>
    <StartTime/>
    <StopTime/>
    </Proposed>
    </Mon>
    <Tue>
    <Existing>
    <StartTime/>
    <StopTime/>
    </Existing>
    <Proposed>
    <StartTime/>
    <StopTime/>
    </Proposed>
    </Tue>
    <Wed>
    <Existing>
    <StartTime/>
    <StopTime/>
    </Existing>
    <Proposed>
    <StartTime/>
    <StopTime/>
    </Proposed>
    </Wed>
    <Thu>
    <Existing>
    <StartTime/>
    <StopTime/>
    </Existing>
    <Proposed>
    <StartTime/>
    <StopTime/>
    </Proposed>
    </Thu>
    <Fri>
    <Existing>
    <StartTime/>
    <StopTime/>
    </Existing>
    <Proposed>
    <StartTime/>
    <StopTime/>
    </Proposed>
    </Fri>
    <Sat>
    <Existing>
    <StartTime/>
    <StopTime/>
    </Existing>
    <Proposed>
    <StartTime/>
    <StopTime/>
    </Proposed>
    </Sat>
    <Sun>
    <Existing>
    <StartTime/>
    <StopTime/>
    </Existing>
    <Proposed>
    <StartTime/>
    <StopTime/>
    </Proposed>
    </Sun>
    </Working>
    <Opening>
    <Mon>
    <Existing>
    <StartTime/>
    <StopTime/>
    </Existing>
    <Proposed>
    <StartTime/>
    <StopTime/>
    </Proposed>
    </Mon>
    <Tue>
    <Existing>
    <StartTime/>
    <StopTime/>
    </Existing>
    <Proposed>
    <StartTime/>
    <StopTime/>
    </Proposed>
    </Tue>
    <Wed>
    <Existing>
    <StartTime/>
    <StopTime/>
    </Existing>
    <Proposed>
    <StartTime/>
    <StopTime/>
    </Proposed>
    </Wed>
    <Thu>
    <Existing>
    <StartTime/>
    <StopTime/>
    </Existing>
    <Proposed>
    <StartTime/>
    <StopTime/>
    </Proposed>
    </Thu>
    <Fri>
    <Existing>
    <StartTime/>
    <StopTime/>
    </Existing>
    <Proposed>
    <StartTime/>
    <StopTime/>
    </Proposed>
    </Fri>
    <Sat>
    <Existing>
    <StartTime/>
    <StopTime/>
    </Existing>
    <Proposed>
    <StartTime/>
    <StopTime/>
    </Proposed>
    </Sat>
    <Sun>
    <Existing>
    <StartTime/>
    <StopTime/>
    </Existing>
    <Proposed>
    <StartTime/>
    <StopTime/>
    </Proposed>
    </Sun>
    </Opening>
    </HoursOfWork>
    <HazardousSubstances>
    <TradeWaste/>
    <HazardousStorage>false</HazardousStorage>
    <HazardousMaterial/>
    </HazardousSubstances>
    <AgriculturalHoldingsCertificate>
    <SignatureDetails>
    <pType:Signatory>
    <pType:personTitle>mr</pType:personTitle>
    <pType:FirstName>simon</pType:FirstName>
    <pType:LastName>townsend</pType:LastName>
    </pType:Signatory>
    <SignatureDate>2004-04-15</SignatureDate>
    </SignatureDetails>
    <AgriculturalJustification/>
    <NoticeGiven>
    <pType:NoticeRecipient>
    <pType:NoticeRecipientOrganisation/>
    <pType:NoticeRecipientPerson>
    <pType:personTitle/>
    <pType:FirstName/>
    <pType:LastName/>
    </pType:NoticeRecipientPerson>
    <pType:NoticeRecipientAddress>
    <bs7666:SAON/>
    <bs7666:pAON/>
    <bs7666:StreetDescription/>
    <bs7666:Locality/>
    <bs7666:Town/>
    <bs7666:AdministrativeArea/>
    <bs7666:postTown/>
    <bs7666:postCode/>
    </pType:NoticeRecipientAddress>
    </pType:NoticeRecipient>
    <NoticeGivenDate/>
    </NoticeGiven>
    </AgriculturalHoldingsCertificate>
    <Certificate>
    <CertificateSelected>CertificateA</CertificateSelected>
    <SignatureDetails>
    <pType:Signatory>
    <pType:personTitle>Mr</pType:personTitle>
    <pType:FirstName>Simon</pType:FirstName>
    <pType:LastName>Townsend</pType:LastName>
    </pType:Signatory>
    <SignatureDate>2004-04-14</SignatureDate>
    </SignatureDetails>
    <NoticeGiven>
    <pType:NoticeRecipient>
    <pType:NoticeRecipientOrganisation/>
    <pType:NoticeRecipientAddress>
    <bs7666:SAON/>
    <bs7666:pAON/>
    <bs7666:StreetDescription/>
    <bs7666:Locality/>
    <bs7666:Town/>
    <bs7666:AdministrativeArea/>
    <bs7666:postTown/>
    <bs7666:postCode/>
    </pType:NoticeRecipientAddress>
    <pType:NoticeRecipientPerson>
    <pType:personTitle/>
    <pType:FirstName/>
    <pType:LastName/>
    </pType:NoticeRecipientPerson>
    </pType:NoticeRecipient>
    <NoticeGivenDate/>
    </NoticeGiven>
    <NotNotified>
    <pType:NotificationStepsTaken/>
    <Advertisement>
    <AdvertDate/>
    <PublicationName/>
    </Advertisement>
    </NotNotified>
    </Certificate>
    </form:form>
    </PlanningApplication></PlanningPortalXML></DGPPPlanningApplication1_0>


    The XSL file is as follows:

    <?xml version="1.0" encoding="ISO-8859-1"?>
    <xsl:transform version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:pp="http://www.planningportal.gov.uk/schema/XForm/Proposal-2003"
    xmlns:pa1="http://www.planningportal.gov.uk/schema/XForm/PlanningApp1-2003"
    xmlns:list="http://www.planningportal.gov.uk/schema/XForm/ListedBuilding-2003"
    xmlns:advert="http://www.planningportal.gov.uk/schema/XForm/Advert-2003"
    xmlns:householder="http://www.planningportal.gov.uk/schema/XForm/Householder-2003"
    xmlns:pins="http://www.planningportal.gov.uk/schema/XForm-2003"
    xmlns:pType="http://www.govtalk.gov.uk/planning/PINSTypes-2003"
    xmlns:bs7666="http://www.govtalk.gov.uk/people/bs7666"
    xmlns:address="http://www.govtalk.gov.uk/people/AddressAndPersonalDetails"
    xmlns:brch="http://www.govtalk.gov.uk/planning/OnlinePlanningBreachComplaint-200401"
    xmlns:ldc191="http://www.planningportal.gov.uk/schema/XForm/Ldc191-2003"
    xmlns:ldc192="http://www.planningportal.gov.uk/schema/XForm/Ldc192-2003"
    xmlns:woodland="http://www.planningportal.gov.uk/schema/XForm/Woodland-2003"
    >

    <xsl:eek:utput method="xml" version="1.0"/>

    <xsl:template match="SubID"></xsl:template>
    <xsl:template match="APPNO"></xsl:template>
    <xsl:template match="RefNum"></xsl:template>
    <xsl:template match="FormattedRefNum"></xsl:template>
    <xsl:template match="DateSubmittedToPortal"></xsl:template>
    <xsl:template match="Description"></xsl:template>

    <xsl:template match="PlanningPortalXML/pp:planningApplication/pa1:form">
    <proposal>
    <PlanningApplicationMain>
    <xsl:call-template name="pinsForm" >
    <xsl:with-param name="context"
    select="/PlanningPortalXML/pp:planningApplication/pa1:form" />
    <xsl:with-param name="type">FUL</xsl:with-param>
    </xsl:call-template>
    </PlanningApplicationMain>
    <PlanningApplicationDetails>
    <xsl:call-template name="forwardPlanning" >
    <xsl:with-param name="context"
    select="/PlanningPortalXML/pp:planningApplication/pa1:form" />
    </xsl:call-template>
    </PlanningApplicationDetails>
    </proposal>
    </xsl:template>

    <xsl:template name="pinsForm">
    <xsl:param name="context"/>
    <xsl:param name="type"/>
    <external_source>PLANNING</external_source>
    <external_id>
    <xsl:value-of
    select="PlanningApplication/pp:Context/pp:portalRefNo"
    />_<xsl:value-of select="$type"/>
    </external_id>
    <record_number>0</record_number>
    <application_number />
    <application_type>
    <xsl:choose>
    <xsl:when test="$type != 'FUL'">
    <xsl:value-of select="$type" />
    </xsl:when>
    <xsl:when test="$type = 'FUL'"><xsl:value-of select="$type"
    /></xsl:when>
    <xsl:when test="$context/pins:TypeOfApplication/pins:ReservedMatters/*
    = 'true'">RES</xsl:when>
    <xsl:when test="$context/pins:TypeOfApplication/pins:planningPortalXML/pins:ChangeUse
    = 'true'">COU</xsl:when>
    <xsl:when test="$context/pins:HazardousSubstances/pins:HazardousStorage
    = 'true'">HAZ</xsl:when>
    <xsl:when test="$context/pins:HazardousSubstances/pins:TradeWaste
    !=''">HAZ</xsl:when>
    <xsl:when test="$context/pins:HazardousSubstances/pins:HazardousMaterial
    !=''">HAZ</xsl:when>
    <xsl:when test="$context/pins:ListedBuildingAppType/pins:ConservationArea/*
    = 'true' ">CAC</xsl:when>
    <xsl:when test="$context/pins:TypeOfApplication/pins:Type">
    <xsl:value-of select="substring($context/pins:TypeOfApplication/pins:Type,1,3)"/>
    </xsl:when>
    <xsl:eek:therwise>???</xsl:eek:therwise>
    </xsl:choose>
    </application_type>
    <uprn>
    <xsl:value-of select="$context/pins:SiteLocation/pins:uprn"/>
    </uprn>
    <location>
    <xsl:choose>
    <xsl:when test="$context/pins:SiteLocation/pins:SameAsApplicant='true'">
    <xsl:call-template name="format-address">
    <xsl:with-param name="separator"><xsl:text>
    </xsl:text></xsl:with-param>
    <xsl:with-param name="address"
    select="$context/pins:ApplicantAddress/pins:ContactDetails/pType:ExternalAddress"/>
    </xsl:call-template>
    </xsl:when>
    <xsl:when test="$context/pins:SiteLocation/pType:ExternalAddress/*
    != ''">
    <xsl:call-template name="format-address">
    <xsl:with-param name="separator"><xsl:text>
    </xsl:text></xsl:with-param>
    <xsl:with-param name="address"
    select="$context/pins:SiteLocation/pType:ExternalAddress"/>
    </xsl:call-template>
    </xsl:when>
    <xsl:eek:therwise>
    <xsl:value-of select="$context/pins:SiteLocation/pins:OtherLocation"/>
    </xsl:eek:therwise>
    </xsl:choose>
    </location>
    <proposal>
    <xsl:value-of select="normalize-space($context/pins:proposalDescription)"/>
    </proposal>
    <application_date>
    <xsl:call-template name="format-date">
    <xsl:with-param name="date">
    <xsl:value-of select="$context/pins:Certificate/pins:SignatureDetails/pins:SignatureDate"/>
    </xsl:with-param>
    </xsl:call-template>
    </application_date>
    <xsl:call-template name="contact-details">
    <xsl:with-param name="contact"
    select="$context/pins:ApplicantAddress"/>
    <xsl:with-param name="type">applicants</xsl:with-param>
    <xsl:with-param name="phone1">home</xsl:with-param>
    <xsl:with-param name="phone2">work</xsl:with-param>
    </xsl:call-template>
    <xsl:call-template name="contact-details">
    <xsl:with-param name="contact"
    select="$context/pins:AgentAddress"/>
    <xsl:with-param name="type">agents</xsl:with-param>
    <xsl:with-param name="phone1">1</xsl:with-param>
    <xsl:with-param name="phone2">2</xsl:with-param>
    </xsl:call-template>
    <fee_due>
    <!-- DC at PP stated that amountDue (total for Proposal) is never
    broken down and allocated to individ. applics within the Proposal -->
    <!-- Therefore, <FeeDue> will always be 0, so use amountDue and
    amountPaid for populating <fee_due> & <fee_paid> within pda_planning
    -->
    <!--<xsl:value-of select="$context/parent::*/pins:FeeDue"/>-->
    <xsl:value-of select="/PlanningPortalXML/pp:payment/pp:amountDue"/>
    </fee_due>
    <fee_paid>
    <!-- This is always zero (£0.00). Set to amountDue so paid = due
    -->
    <!--<xsl:value-of
    select="/PlanningPortalXML/pp:payment/pp:amountPaid"/>-->
    <xsl:value-of select="/PlanningPortalXML/pp:payment/pp:amountDue"/>
    </fee_paid>
    <lbgrade_code>
    <xsl:choose>
    <xsl:when test="$context/pins:BuildingInformation/pins:Grade/pins:One
    = 'true'">
    <xsl:text>I</xsl:text>
    </xsl:when>
    <xsl:when test="$context/pins:BuildingInformation/pins:Grade/pins:Two
    = 'true'">
    <xsl:text>II</xsl:text>
    </xsl:when>
    <xsl:when test="$context/pins:BuildingInformation/pins:Grade/pins:TwoStar
    = 'true'">
    <xsl:text>II*</xsl:text>
    </xsl:when>
    <xsl:when test="$context/pins:BuildingInformation/pins:Grade/pins:Ecclesiastical
    = 'true'">
    <xsl:text>E</xsl:text>
    </xsl:when>
    </xsl:choose>
    </lbgrade_code>
    <gridref_east/>
    <gridref_north/>
    <os_map_ref/>
    <land_use_old>
    <xsl:value-of select="$context/pins:ExistingUses/pins:previousUse"/>
    </land_use_old>
    <land_use_new>
    <xsl:value-of select="$context/pins:ExistingUses/pins:CurrentUse"/>
    </land_use_new>
    <applicants_fax>
    <xsl:value-of select="$context/pins:ApplicantAddress/pins:ContactDetails/pType:EmailTelephoneFax/address:Fax/address:FaxNationalNumber"/>
    </applicants_fax>
    <applicants_email>
    <xsl:value-of select="$context/pins:ApplicantAddress/pins:ContactDetails/pType:EmailTelephoneFax/address:Email/address:EmailAddress"/>
    </applicants_email>
    <agents_fax>
    <xsl:value-of select="$context/pins:AgentAddress/pins:ContactDetails/pType:EmailTelephoneFax/address:Fax/address:FaxNationalNumber"/>
    </agents_fax>
    <agents_email>
    <xsl:value-of select="$context/pins:AgentAddress/pins:ContactDetails/pType:EmailTelephoneFax/address:Email/address:EmailAddress"/>
    </agents_email>
    <land_prev_use>
    <xsl:value-of select="$context/pins:ExistingUses/pins:previousUse"/>
    </land_prev_use>
    <brown_field_site>
    <xsl:choose>
    <xsl:when test="$context/pins:ResidentialInformation/pins:LandType
    = 'Brownfield'">Y</xsl:when>
    <xsl:eek:therwise>N</xsl:eek:therwise>
    </xsl:choose>
    </brown_field_site>
    <has_gis_plot>N</has_gis_plot>
    <received_date>!TODAY!</received_date>
    <modification_date>!TODAY!</modification_date>
    <tpo_number>
    <xsl:value-of select="$context/pins:WoodlandApplication/pins:TPONo"/>
    </tpo_number>
    </xsl:template>


    <xsl:template name="forwardPlanning">
    <xsl:param name="context"/>
    <record_number />
    <affect_pub_right>
    <xsl:choose>
    <xsl:when test="$context/pins:publicRightOfWay/pins:IsAltering =
    'true'">Y</xsl:when>
    <xsl:eek:therwise>N</xsl:eek:therwise>
    </xsl:choose>
    </affect_pub_right>
    <site_area_sqm>
    <xsl:if test="$context/pins:SiteArea/pins:Units='sq.metres'">
    <xsl:value-of select="$context/pins:SiteArea/pins:SiteAreaValues"
    />
    </xsl:if>
    </site_area_sqm>
    <site_area_hec>
    <xsl:if test="$context/pins:SiteArea/pins:Units='Hectares'">
    <xsl:value-of select="$context/pins:SiteArea/pins:SiteAreaValues"
    />
    </xsl:if>
    </site_area_hec>
    <exist_other_floorspace>
    <xsl:value-of select="$context/pins:SiteArea/pins:ExistingFloorspace"
    />
    </exist_other_floorspace>
    <new_other_floorspace>
    <xsl:value-of select="$context/pins:SiteArea/pins:proposedFloorspace"
    />
    </new_other_floorspace>
    <total_houses>
    <xsl:value-of select="$context/pins:ResidentialInformation/pins:ResidentialUnitChanges/pins:House/pins:Existing"
    />
    </total_houses>
    <prop_houses>
    <xsl:value-of select="$context/pins:ResidentialInformation/pins:ResidentialUnitChanges/pins:House/pins:proposed"
    />
    </prop_houses>
    <total_flats>
    <xsl:value-of select="$context/pins:ResidentialInformation/pins:ResidentialUnitChanges/pins:Flat/pins:Existing"
    />
    </total_flats>
    <prop_flats>
    <xsl:value-of select="$context/pins:ResidentialInformation/pins:ResidentialUnitChanges/pins:Flat/pins:proposed"
    />
    </prop_flats>
    <total_others> <!-- AIM : doing test below but not actually
    comparing the values with anything -->
    <xsl:choose>
    <xsl:when test="$context/pins:ResidentialInformation/pins:ResidentialUnitChanges/pins:Other/pins:Existing
    != ''">
    <xsl:value-of select="$context/pins:ResidentialInformation/pins:ResidentialUnitChanges/pins:Other/pins:Existing"
    />
    </xsl:when>
    </xsl:choose>
    </total_others>
    <prop_others>
    <xsl:choose>
    <xsl:when test="$context/pins:ResidentialInformation/pins:ResidentialUnitChanges/pins:Other/pins:proposed
    != ''">
    <xsl:value-of select="$context/pins:ResidentialInformation/pins:ResidentialUnitChanges/pins:Other/pins:proposed"
    />
    </xsl:when>
    </xsl:choose>
    </prop_others>
    <exist_car_parking>
    <xsl:value-of select="$context/pins:parking/pins:Cars/pins:Existing"
    />
    </exist_car_parking>
    <prop_car_parking>
    <xsl:value-of select="$context/pins:parking/pins:Cars/pins:New" />
    </prop_car_parking>
    <exist_hgv_parking>
    <xsl:value-of select="$context/pins:parking/pins:GoodsVehicle/pins:Existing"
    />
    </exist_hgv_parking>
    <prop_hgv_parking>
    <xsl:value-of select="$context/pins:parking/pins:GoodsVehicle/pins:New"
    />
    </prop_hgv_parking>
    </xsl:template>

    <!-- Specific subs for formatting repeated values like addresses -->
    <xsl:template name="contact-details">
    <xsl:param name="contact"/>
    <xsl:param name="type"/>
    <xsl:param name="phone1"/>
    <xsl:param name="phone2"/>
    <xsl:element name="{$type}_name">
    <xsl:call-template name="format-name">
    <xsl:with-param name="ptype-name"
    select="$contact/pins:Name/pins:personName"/>
    </xsl:call-template>
    </xsl:element>
    <xsl:element name="{$type}_address">
    <xsl:call-template name="format-address">
    <xsl:with-param name="separator"><xsl:text>
    </xsl:text></xsl:with-param>
    <xsl:with-param name="address"
    select="$contact/pins:ContactDetails/pType:ExternalAddress"/>
    </xsl:call-template>
    </xsl:element>
    <xsl:element name="{$type}_phone_{$phone1}">
    <xsl:value-of select="$contact/pins:ContactDetails/pType:EmailTelephoneFax/address:Telephone[@TelUse='home']/address:TelNationalNumber"/>
    </xsl:element>
    <xsl:element name="{$type}_phone_{$phone2}">
    <xsl:value-of select="$contact/pins:ContactDetails/pType:EmailTelephoneFax/address:Telephone[@TelUse='work']/address:TelNationalNumber"/>
    </xsl:element>
    <xsl:element name="{$type}_salutation">
    <xsl:value-of select="$contact/pins:Name/pins:personName/pType:personTitle"/>
    </xsl:element>
    </xsl:template>
    <!-- Generic formatting functions -->
    <xsl:template name="format-name">
    <xsl:param name="ptype-name"/>
    <xsl:value-of select="$ptype-name/pType:FirstName"/>
    <xsl:if test="normalize-space($ptype-name/pType:FirstName) != ''">
    <xsl:text> </xsl:text>
    </xsl:if>
    <xsl:for-each select="$ptype-name/pType:MiddleName">
    <xsl:value-of select="."/>
    <xsl:if test="normalize-space(.) != ''">
    <xsl:text> </xsl:text>
    </xsl:if>
    </xsl:for-each>
    <xsl:value-of select="$ptype-name/pType:LastName"/>
    </xsl:template>
    <!--
    turn bs7666 address into space separated string
    -->
    <xsl:template name="format-address">
    <xsl:param name="separator"/>
    <xsl:param name="address"/>
    <xsl:if test="normalize-space($address/bs7666:SAON)!= ''">
    <xsl:value-of select="$address/bs7666:SAON"/>
    <xsl:value-of select="$separator"/>
    </xsl:if>
    <xsl:if test="normalize-space($address/bs7666:pAON) != ''">
    <xsl:value-of select="$address/bs7666:pAON"/>
    <xsl:value-of select="$separator"/>
    </xsl:if>
    <xsl:if test="normalize-space($address/bs7666:StreetDescription) !=
    ''">
    <xsl:value-of select="$address/bs7666:StreetDescription"/>
    <xsl:value-of select="$separator"/>
    </xsl:if>
    <xsl:if test="normalize-space($address/bs7666:Town) != ''">
    <xsl:value-of select="$address/bs7666:Town"/>
    <xsl:value-of select="$separator"/>
    </xsl:if>
    <xsl:if test="normalize-space($address/bs7666:Locality) != ''">
    <xsl:value-of select="$address/bs7666:Locality"/>
    <xsl:value-of select="$separator"/>
    </xsl:if>
    <xsl:if test="normalize-space($address/bs7666:County) != ''">
    <xsl:value-of select="$address/bs7666:County"/>
    <xsl:value-of select="$separator"/>
    </xsl:if>
    <xsl:value-of select="$address/bs7666:postCode"/>
    </xsl:template>
    <!--
    format ddmmyy by:
    1. if blank, create earliest date possible
    2. otherwise add time on the end
    -->
    <xsl:template name="format-date">
    <xsl:param name="date"/>
    <xsl:choose>
    <xsl:when test="$date = ''">1899-12-30T00:00:00Z</xsl:when>
    <xsl:eek:therwise>
    <xsl:value-of select="$date"/>
    <xsl:text>T00:00:00Z</xsl:text>
    </xsl:eek:therwise>
    </xsl:choose>
    </xsl:template>
    </xsl:transform>

    I appreciate your help. Thanks.

    Jimmy
     
    Jimmy, Oct 15, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Robert Hanson
    Replies:
    2
    Views:
    367
    Robert V. Hanson
    Jul 3, 2003
  2. Replies:
    1
    Views:
    3,636
    A. Bolmarcich
    May 27, 2005
  3. eBob.com
    Replies:
    2
    Views:
    113
    eBob.com
    May 16, 2008
  4. jennifer stone

    request for guidance

    jennifer stone, Dec 13, 2013, in forum: Python
    Replies:
    3
    Views:
    98
    Wolfgang Keller
    Dec 19, 2013
  5. Zachary Ware

    Re: request for guidance

    Zachary Ware, Dec 13, 2013, in forum: Python
    Replies:
    0
    Views:
    82
    Zachary Ware
    Dec 13, 2013
Loading...

Share This Page