Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > XSL assistance / guidance request - PLEASE!!

Reply
Thread Tools

XSL assistance / guidance request - PLEASE!!

 
 
Jimmy
Guest
Posts: n/a
 
      10-15-2004
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/pplanningApplication/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"
xmlnsType="http://www.govtalk.gov.uk/planning/PINSTypes-2003"
xmlnsins="http://www.planningportal.gov.uk/schema/XForm-2003"
xmlnssi="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>
<pTypeersonTitle>Mr</pTypeersonTitle>
<pType:FirstName>Simon</pType:FirstName>
<pType:LastName>Townsend</pType:LastName>
</PersonName>
</Name>
<ContactDetails PreferredContactMedium="Post">
<pType:Availability/>
<pType:ExternalAddress>
<bs7666:SAON/>
<bs7666AON>Churchill House</bs7666AON>
<bs7666:StreetDescription>Churchill
Road</bs7666:StreetDescription>
<bs7666:Locality/>
<bs7666:Town>Cheltenham</bs7666:Town>
<bs7666:AdministrativeArea/>
<bs7666ostTown/>
<bs7666ostCode>Gl537EG</bs7666ostCode>
</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>
<pTypeersonTitle/>
<pType:FirstName/>
<pType:LastName/>
</PersonName>
</Name>
<ContactDetails PreferredContactMedium="Post">
<pType:Availability/>
<pType:ExternalAddress>
<bs7666:SAON/>
<bs7666AON/>
<bs7666:StreetDescription/>
<bs7666:Locality/>
<bs7666:Town/>
<bs7666:AdministrativeArea/>
<bs7666ostTown/>
<bs7666ostCode/>
</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>
<bs7666AON>GROSVENOR HOUSE</bs7666AON>
<bs7666:StreetDescription>HALTON LEA</bs7666:StreetDescription>
<bs7666:Locality/>
<bs7666:Town>RUNCORN</bs7666:Town>
<bs7666:AdministrativeArea>CHESHIRE</bs7666:AdministrativeArea>
<bs7666ostTown/>
<bs7666ostCode>WA7 2GW</bs7666ostCode>
</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>
<pTypeersonTitle>mr</pTypeersonTitle>
<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>
<pTypeersonTitle/>
<pType:FirstName/>
<pType:LastName/>
</pType:NoticeRecipientPerson>
<pType:NoticeRecipientAddress>
<bs7666:SAON/>
<bs7666AON/>
<bs7666:StreetDescription/>
<bs7666:Locality/>
<bs7666:Town/>
<bs7666:AdministrativeArea/>
<bs7666ostTown/>
<bs7666ostCode/>
</pType:NoticeRecipientAddress>
</pType:NoticeRecipient>
<NoticeGivenDate/>
</NoticeGiven>
</AgriculturalHoldingsCertificate>
<Certificate>
<CertificateSelected>CertificateA</CertificateSelected>
<SignatureDetails>
<pType:Signatory>
<pTypeersonTitle>Mr</pTypeersonTitle>
<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/>
<bs7666AON/>
<bs7666:StreetDescription/>
<bs7666:Locality/>
<bs7666:Town/>
<bs7666:AdministrativeArea/>
<bs7666ostTown/>
<bs7666ostCode/>
</pType:NoticeRecipientAddress>
<pType:NoticeRecipientPerson>
<pTypeersonTitle/>
<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"
xmlnssl="http://www.w3.org/1999/XSL/Transform"
xmlnsp="http://www.planningportal.gov.uk/schema/XForm/Proposal-2003"
xmlnsa1="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"
xmlnsins="http://www.planningportal.gov.uk/schema/XForm-2003"
xmlnsType="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"
>

<xslutput 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/pplanningApplication/pa1:form">
<proposal>
<PlanningApplicationMain>
<xsl:call-template name="pinsForm" >
<xsl:with-param name="context"
select="/PlanningPortalXML/pplanningApplication/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/pplanningApplication/pa1:form" />
</xsl:call-template>
</PlanningApplicationDetails>
</proposal>
</xsl:template>

<xsl:template name="pinsForm">
<xslaram name="context"/>
<xslaram name="type"/>
<external_source>PLANNING</external_source>
<external_id>
<xsl:value-of
select="PlanningApplication/pp:Context/pportalRefNo"
/>_<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/pinslanningPortalXML/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>
<xsltherwise>???</xsltherwise>
</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>
<xsltherwise>
<xsl:value-of select="$context/pins:SiteLocation/pins:OtherLocation"/>
</xsltherwise>
</xsl:choose>
</location>
<proposal>
<xsl:value-of select="normalize-space($context/pinsroposalDescription)"/>
</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/ppayment/pp:amountDue"/>
</fee_due>
<fee_paid>
<!-- This is always zero (0.00). Set to amountDue so paid = due
-->
<!--<xsl:value-of
select="/PlanningPortalXML/ppayment/pp:amountPaid"/>-->
<xsl:value-of select="/PlanningPortalXML/ppayment/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/pinsreviousUse"/>
</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/pinsreviousUse"/>
</land_prev_use>
<brown_field_site>
<xsl:choose>
<xsl:when test="$context/pins:ResidentialInformation/pins:LandType
= 'Brownfield'">Y</xsl:when>
<xsltherwise>N</xsltherwise>
</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">
<xslaram name="context"/>
<record_number />
<affect_pub_right>
<xsl:choose>
<xsl:when test="$context/pinsublicRightOfWay/pins:IsAltering =
'true'">Y</xsl:when>
<xsltherwise>N</xsltherwise>
</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/pinsroposedFloorspace"
/>
</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/pinsroposed"
/>
</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/pinsroposed"
/>
</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/pinsroposed
!= ''">
<xsl:value-of select="$context/pins:ResidentialInformation/pins:ResidentialUnitChanges/pins:Other/pinsroposed"
/>
</xsl:when>
</xsl:choose>
</prop_others>
<exist_car_parking>
<xsl:value-of select="$context/pinsarking/pins:Cars/pins:Existing"
/>
</exist_car_parking>
<prop_car_parking>
<xsl:value-of select="$context/pinsarking/pins:Cars/pins:New" />
</prop_car_parking>
<exist_hgv_parking>
<xsl:value-of select="$context/pinsarking/pins:GoodsVehicle/pins:Existing"
/>
</exist_hgv_parking>
<prop_hgv_parking>
<xsl:value-of select="$context/pinsarking/pins:GoodsVehicle/pins:New"
/>
</prop_hgv_parking>
</xsl:template>

<!-- Specific subs for formatting repeated values like addresses -->
<xsl:template name="contact-details">
<xslaram name="contact"/>
<xslaram name="type"/>
<xslaram name="phone1"/>
<xslaram name="phone2"/>
<xsl:element name="{$type}_name">
<xsl:call-template name="format-name">
<xsl:with-param name="ptype-name"
select="$contact/pins:Name/pinsersonName"/>
</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/pinsersonName/pTypeersonTitle"/>
</xsl:element>
</xsl:template>
<!-- Generic formatting functions -->
<xsl:template name="format-name">
<xslaram 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">
<xslaram name="separator"/>
<xslaram 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/bs7666AON) != ''">
<xsl:value-of select="$address/bs7666AON"/>
<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/bs7666ostCode"/>
</xsl:template>
<!--
format ddmmyy by:
1. if blank, create earliest date possible
2. otherwise add time on the end
-->
<xsl:template name="format-date">
<xslaram name="date"/>
<xsl:choose>
<xsl:when test="$date = ''">1899-12-30T00:00:00Z</xsl:when>
<xsltherwise>
<xsl:value-of select="$date"/>
<xsl:text>T00:00:00Z</xsl:text>
</xsltherwise>
</xsl:choose>
</xsl:template>
</xsl:transform>

I appreciate your help. Thanks.

Jimmy
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Guidance Request (and a specific question) eBob.com Javascript 2 05-16-2008 05:26 PM
Request for Test Assistance: SIP Discount Trial Account Test Request News Reader UK VOIP 3 10-26-2006 07:34 AM
XSL Question tp xsl:for-each and xsl:variable schaf@2wire.ch XML 1 05-27-2005 09:25 PM
Re: Accessing Request.InputStream / Request.BinaryRead *as the request is occuring*: How??? Brian Birtle ASP .Net 2 10-16-2003 02:11 PM
Request for guidance storing of information in ASP.Net Robert Hanson ASP .Net 2 07-03-2003 03:30 AM



Advertisments