Avatar of kwok76_uk
kwok76_uk
Flag for United Kingdom of Great Britain and Northern Ireland asked on

XSL 'Contains' function problem

Hi,
Im trying to populate some data into a table I created in open office. At the moment the information is not coming through. I have used the contains function but I can only bring up the information for the first data called Application_No and not the others.  

I can create a code that will work for each of these in separate columns but I need all the information to be in a single column rather than separate.


GWAbstract_Application=<xsl:for-each select="//layer/feature/attribute/value[../../../name='abstract'][contains(../name,'Application_No')]"><xsl:text>~</xsl:text> \
              <xsl:text>Original Application No: </xsl:text><xsl:value-of select="self::node()[../name='Application_No']"/>\
              :::\
              <xsl:text>Original Start Date: </xsl:text><xsl:value-of select="self::node()[../name='Orig_Effective_Date']"/>\
              :::\
              <xsl:text>Expiry Date: </xsl:text><xsl:value-of select="self::node()[../name='Expiry_Date']"/>\
              :::\
              <xsl:text>Issue No: </xsl:text><xsl:value-of select="self::node()[../name='Issue_No']"/>\
              :::\
              <xsl:text>Version Start Date: </xsl:text><xsl:value-of select="self::node()[../name='Version_Start_Date']"/>\
              :::\
              <xsl:text>Version End Date: </xsl:text><xsl:value-of select="self::node()[../name='Version_End_Date']"/>\
             </xsl:for-each>

Open in new window

Web Languages and StandardsProgramming Languages-Other

Avatar of undefined
Last Comment
kwok76_uk

8/22/2022 - Mon
abel

I'm afraid your question is not totally clear. Do you have an XSLT source that shows what you are trying to do? The snippet above seems to be a string of data concatenated together into a variable, but to help you out we need the context, i.e., the whole XSLT file.

Then, what values do you want contains() to match and that you want to show up in a certain column?

You have a very complex for-each above, it might be easier to rewrite it to use normal template matching, but that might be just a matter of taste.

The function contains() returns a boolean. If you want it to match more than one value, you can use it like

[contains(../name,'Application_No') or contains(../name,'otherstring')]
kwok76_uk

ASKER
I have to agree it is very complex. All i'm trying to do is retrieve some data and place this in to a single column that i have already created in open office. The first code that i sent is what i would like to have to appear in the column which is all of them. May be i'm using the wrong function 'contains'?
I need to retrieve all 6 into a single column.
Original Application No:
Original Start Date:
Expiry Date:
Issue No:
Version Start Date:
Version End Date:

I can write a code to retrieve the above by themselves for a single column but i need all 6 of them to appear in a single column rather than just the one.  
Below would retrieve just the one;
Abstract_application=<xsl:for-each select="//layer/feature/attribute/value[../../../name='abstract']"> \<xsl:text>~</xsl:text><xsl:value-of select="self::node()[../name=' Application_No'']"/>\ </xsl:for-each>



#<!-- Homebuyers Report Tag Properties Information File
 
#Description  This file describes the specific properties of the tag properties entries found within the OpenOffice Homebuyers Review Template.
 
#Change History
 
#04/02/05 dbm - first version based on historic file at this time
#14/02/05 mgc - added tags after making HBR template generic and including covering letter
#Comments
#the ~ is a separator in the tables
 #-->
 
#<!-- properties with xml for tags -->
#<!-- ~~~~~~~~~~~~~~~~~~~~~~ static Values ~~~~~~~~~~~~~~~~~~~~~~ -->
EncReport=GroundSure Homebuyers
ReportName=GroundSure<text:line-break/>Homebuyers
ReportTitle=GroundSure Homebuyers
ReportDeliveryMethodTextR=Report Delivery Method:
#ReportDeliveryMethodTextR=\
#	<xsl:variable name="CheckTW"> \
#		<xsl:value-of select="//parameter/value[../name='ClientEmail']"/> \
#	</xsl:variable> \
#	<xsl:choose> \
#		<xsl:when test="$CheckTW='home.zone@thameswater.co.uk'">Fax</xsl:when> \
#<xsl:otherwise>Report Delivery Method</xsl:otherwise> \
#	</xsl:choose>
ReportDeliveryMethodR=Email - pdf
ClientRefName=Your Reference:
ReportRefName=Report Reference:
DeptRef=
CustLetterFooterText=
GuidanceContact=the GroundSure Technical Helpline on (T) 01273 819700, (F) 01273 377902.
CustParaPlanning=
TWEmail=
#Changes for TW Specific Letter
AddTag=Address
TW=
TWDate=
ReportDateName=Report Date
ThamesText=#DELETE#
OthersText=
#Changes for TW Specific Letter
 
ClientFaxTextR=
ClientEmailTextR=
ClientDXTextR=
HBRCustLetterHeaderAddress=Blank_HeaderAddress.gif
FrontPageCustLogo=Blank_HeaderAddress.gif
CustomerDepartment=
ContactAddress=
CustLetterSignature=Blank_Signature.gif
CustLetterFooterLogo=Blank_Footer_logo.gif
BodyPageLogo=Blank_Header.gif
ReportPageLogo=Blank_Contact_logo.gif
#<!-- EA specific tags - static #
EACopyright=Environment Agency 2005
EAReseller=#DELETE#
DistributorReferenceText=Distributor Reference
CustEAFrontPageLogo=Blank_EA_Cover.gif
EAGuidanceContact=the Environment Agency's National Customer Contact Centre on 08708 506506, or contact your original report supplier
EAFooterContactLeft=Environment Agency Property Search
EAFooterContactRight=For Further Information contact NCCC on 08708 506 506
EAResellerLogo=EADefaultResellerLogo.gif
#<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  input parameters   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
Title=<xsl:value-of select="//parameter/value[../name='Title']"/>
ContactName=<xsl:text> </xsl:text><xsl:value-of select="//parameter/value[../name='ContactName']"/>
FullContactName=<xsl:value-of select="//parameter/value[../name='Title']"/>\
    <xsl:text> </xsl:text><xsl:value-of select="//parameter/value[../name='ContactName']"/>
ClientGenericTextR=
ClientR=
CAdd1=<xsl:value-of select="//parameter/value[../name='CAdd1']"/>
CAdd2=<xsl:value-of select="//parameter/value[../name='CAdd2']"/>
CAdd3=<xsl:value-of select="//parameter/value[../name='CAdd3']"/>
CAdd4=<xsl:value-of select="//parameter/value[../name='CAdd4']"/>
CCity=<xsl:value-of select="//parameter/value[../name='CCity']"/>
CPCode=<xsl:value-of select="//parameter/value[../name='CPCode']"/>
ThirdPartyRefText=
ThirdPartyRefValue=
LEVEL=\
	<xsl:variable name="LevelTag"> \
		<xsl:value-of select="//parameter/value[../name='CoverLevel']"/> \
	</xsl:variable> \
	<xsl:choose> \
		<xsl:when test="$LevelTag='100,000'">100,000</xsl:when> \
<xsl:otherwise>400,000</xsl:otherwise> \
	</xsl:choose>
	
LEVELcost=\
	<xsl:variable name="LevelCost"> \
		<xsl:value-of select="//parameter/value[../name='CoverLevel']"/> \
	</xsl:variable> \
	<xsl:choose> \
		<xsl:when test="$LevelCost='100,000'">£24.00</xsl:when> \
<xsl:otherwise>£40.00</xsl:otherwise> \
	</xsl:choose>
 
LEVELprev=\
	<xsl:variable name="LevelPrev"> \
		<xsl:value-of select="//parameter/value[../name='CoverLevel']"/> \
	</xsl:variable> \
	<xsl:choose> \
		<xsl:when test="$LevelPrev='100,000'">£13.90</xsl:when> \
<xsl:otherwise>£29.14</xsl:otherwise> \
	</xsl:choose>
 
LEVELtax=\
	<xsl:variable name="LevelTax"> \
		<xsl:value-of select="//parameter/value[../name='CoverLevel']"/> \
	</xsl:variable> \
	<xsl:choose> \
		<xsl:when test="$LevelTax='100,000'">£0.70</xsl:when> \
<xsl:otherwise>£1.46</xsl:otherwise> \
	</xsl:choose>
	
ClientAddressR=
ClientDXR=
ClientFaxR=
ClientEmailR=
DeliveryMethod=<xsl:value-of select="//parameter/value[../name='DeliveryMethod']"/>
 
#ReportDate=\
#	<xsl:variable name="CheckTW"> \
#		<xsl:value-of select="//parameter/value[../name='ClientEmail']"/> \
#	</xsl:variable> \
#	<xsl:choose> \
#		<xsl:when test="$CheckTW='home.zone@thameswater.co.uk'">0118 925 1504</xsl:when> \
#<xsl:otherwise><xsl:value-of select="//parameter/value[../name='ReportDate']"/></xsl:otherwise> \
#	</xsl:choose>
 
ReportDateTag=\
	<xsl:variable name="CheckTW"> \
		<xsl:value-of select="//parameter/value[../name='ClientEmail']"/> \
	</xsl:variable> \
	<xsl:choose> \
		<xsl:when test="$CheckTW='home.zone@thameswater.co.uk'">Phone</xsl:when> \
<xsl:otherwise>Report Date</xsl:otherwise> \
	</xsl:choose>
	
ReportDate=<xsl:value-of select="//parameter/value[../name='ReportDate']"/>
 
#ReportReference=\
#	<xsl:variable name="CheckTW"> \
#		<xsl:value-of select="//parameter/value[../name='ClientEmail']"/> \
#	</xsl:variable> \
#	<xsl:choose> \
#		<xsl:when test="$CheckTW='home.zone@thameswater.co.uk'"><xsl:value-of select="//parameter/value[../name='ClientReference']"/></xsl:when> \
#<xsl:otherwise><xsl:value-of select="//parameter/value[../name='ReportReference']"/></xsl:otherwise> \
#	</xsl:choose>
	
#ClientReference=\
#	<xsl:variable name="CheckTW"> \
#		<xsl:value-of select="//parameter/value[../name='ClientEmail']"/> \
#	</xsl:variable> \
#	<xsl:choose> \
#		<xsl:when test="$CheckTW='home.zone@thameswater.co.uk'"><xsl:value-of select="//parameter/value[../name='ReportReference']"/></xsl:when> \
#<xsl:otherwise><xsl:value-of select="//parameter/value[../name='ClientReference']"/></xsl:otherwise> \
#	</xsl:choose>
	
ReportReference=<xsl:value-of select="//parameter/value[../name='ReportReference']"/>
ClientReference=<xsl:value-of select="//parameter/value[../name='ClientReference']"/>
 
 
ReportAddress=<xsl:value-of select="//parameter/value[../name='ReportAddress']"/><xsl:text> </xsl:text>
ReportAddressEAFrontSplit=<xsl:call-template name="lineSplitter"> \
                  <xsl:with-param name="text" select="//parameter/value[../name='ReportAddress']"></xsl:with-param> \
         </xsl:call-template>                  
 
 
#<!--EditionCheck=\
#	<xsl:variable name="ComCheck"> \
#		<xsl:value-of select="count(//layer/feature/attribute/value[../../../name='NationalGrid' and ../name='Edition_Count'])" /> \
#	</xsl:variable> \
#	<xsl:choose> \
#		<xsl:when test="$ComCheck &gt; 0"> \
#			<xsl:variable name="NGCheck"> \
#				<xsl:value-of select="//layer/feature/attribute/value[../../../name='NationalGrid' and ../name='Edition_Count']" /> \
#			</xsl:variable> \
#			<xsl:variable name="CSCheck"> \
#				<xsl:value-of select="//layer/feature/attribute/value[../../../name='CountySeries' and ../name='Edition_Count']" /> \
#			</xsl:variable> \
#			<xsl:choose> \
#				<xsl:when test="$NGCheck &lt; 2 or $CSCheck &lt; 2">There are less than 2 editions of map data covering this search</xsl:when> \
#				<xsl:otherwise></xsl:otherwise> \
#			</xsl:choose> \
#		</xsl:when> \
#		<xsl:otherwise> \
#			<xsl:variable name="NGCheck"> \
#				<xsl:value-of select="//layer/feature/Edition_Count[../../name='NationalGrid']" /> \
#			</xsl:variable> \
#			<xsl:variable name="CSCheck"> \
#				<xsl:value-of select="//layer/feature/Edition_Count[../../name='CountySeries']" /> \
#			</xsl:variable> \
#			<xsl:choose> \
#				<xsl:when test="$NGCheck &lt; 2 or $CSCheck &lt; 2">There are less than 2 editions of map data covering this search</xsl:when> \
#				<xsl:otherwise></xsl:otherwise> \
#			</xsl:choose> \
#		</xsl:otherwise> \
#	</xsl:choose>-->
 
 
AddTag=\
	<xsl:variable name="CheckTW"> \
		<xsl:value-of select="//parameter/value[../name='ClientEmail']"/> \
	</xsl:variable> \
	<xsl:choose> \
		<xsl:when test="$CheckTW='home.zone@thameswater.co.uk'">Site Details</xsl:when> \
<xsl:otherwise>Address</xsl:otherwise> \
	</xsl:choose>  
	
TWReportDate=\
	<xsl:variable name="CheckTW"> \
		<xsl:value-of select="//parameter/value[../name='ClientEmail']"/> \
	</xsl:variable> \
	<xsl:choose> \
		<xsl:when test="$CheckTW='home.zone@thameswater.co.uk'"><xsl:value-of select="//parameter/value[../name='ReportDate']"/></xsl:when> \
<xsl:otherwise></xsl:otherwise> \
	</xsl:choose> 	
	
scotcheck=\
	<xsl:variable name="check"> \
		<xsl:value-of select="count(//layer/feature[../name='scotcheck' and ./distance &lt; 20])" /> \
	</xsl:variable> \
	<xsl:choose> \
		<xsl:when test="$check &gt; 0">May Be In Scotland - Act Accordingly. Advise TU</xsl:when> \
<xsl:otherwise></xsl:otherwise> \
	</xsl:choose>     
    	                                       
ReportEasting=<xsl:value-of select="//parameter/value[../name='ReportEasting']"/>
ReportNorthing=<xsl:value-of select="//parameter/value[../name='ReportNorthing']"/>
 
InsuranceRequired=<xsl:variable name="apply" select="//parameter/value[../name='Insurance']"/> \
    <xsl:choose> \
      <xsl:when test="$apply = 'InsuranceRequired'"> </xsl:when> \
      <xsl:otherwise>#DELETE#</xsl:otherwise> \
    </xsl:choose>
 
IPT_Calc=<xsl:variable name="IPT_Calc" select="//parameter/value[../name='Premium']"/> \
    <xsl:choose> \
      <xsl:when test="$IPT_Calc = '40'">£1.46 </xsl:when> \
      <xsl:otherwise>£0.70</xsl:otherwise> \
    </xsl:choose>    
 
Total_Calc=<xsl:variable name="Total_Calc" select="//parameter/value[../name='Premium']"/> \
    <xsl:choose> \
      <xsl:when test="$Total_Calc = '40'">£40.00</xsl:when> \
      <xsl:otherwise>£24.00</xsl:otherwise> \
    </xsl:choose>     
        
PartyInsured=<xsl:value-of select="//parameter/value[../name='PartyInsured']"/>
CoverLevel=<xsl:value-of select="//parameter/value[../name='CoverLevel']"/>
 
Premium_Calc=<xsl:variable name="Premium_Calc" select="//parameter/value[../name='Premium']"/> \
    <xsl:choose> \
      <xsl:when test="$Premium_Calc = '40'">£29.14</xsl:when> \
      <xsl:otherwise>£13.90</xsl:otherwise> \
    </xsl:choose>    
 
 
 
 
    
PropertyAge=<xsl:value-of select="//parameter/value[../name='PropertyAge']"/>
 
 
InsNeedsTick=<xsl:variable name="apply" select="//parameter/value[../name='Insurance']"/> \
	<xsl:choose> \
      <xsl:when test="$apply = '&#x221A;'"> </xsl:when> \
		<xsl:otherwise>&#x221A;</xsl:otherwise> \
	</xsl:choose> 
 
eaareas500details=<xsl:if test="count(//layer/feature[../name='EA Areas']) &gt; 0">\
      <xsl:value-of select="//layer/feature/attribute/value[../../../name='EA Areas'\
                                                        and ../name='AreaName']"/>\
      <text:line-break/>\
      <xsl:value-of select="//layer/feature/attribute/value[../../../name='EA Areas'\
                                                        and ../name='AreaOffice']"/>\
      <xsl:text> - </xsl:text>\
      <xsl:value-of select="//layer/feature/attribute/value[../../../name='EA Areas'\
                                                        and ../name='AreaAddress']"/>\
      <xsl:text>,  </xsl:text>\
      <xsl:value-of select="//layer/feature/attribute/value[../../../name='EA Areas'\
                                                        and ../name='Postcode']"/>\
    </xsl:if>
 
latels500details=<xsl:if test="count(//layer/feature[../name='LA Telephones']) &gt; 0">\
      <xsl:value-of select="//layer/feature/attribute/value[../../../name='LA Telephones'\
                                                        and ../name='AuthorityName']"/>\
      <text:line-break/><xsl:text>Tel:  </xsl:text>\
      <xsl:value-of select="//layer/feature/attribute/value[../../../name='LA Telephones'\
                                                        and ../name='AuthorityTelephone']"/>\
     </xsl:if>
#<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ end of input parameters ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
 
#<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ XML Report transformations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
Passed=\
         <xsl:call-template name="conditionalPass">\
            <xsl:with-param name="conditionalTest" select="//rating/description[../layer='general'] = 'Passed'"/>\
            <xsl:with-param name="overrideVariable">override</xsl:with-param>\
            <xsl:with-param name="text" select="//rating/description[../layer='general']"/>\
            <xsl:with-param name="altText" select="//rating/altDescription[../layer='general']"/>\
          </xsl:call-template>
Referred=\
          <xsl:call-template name="conditionalFail">\
            <xsl:with-param name="conditionalTest" select="//rating/description[../layer='general'] = 'Passed'"/>\
            <xsl:with-param name="overrideVariable">override</xsl:with-param>\
            <xsl:with-param name="text" select="//rating/description[../layer='general']"/>\
            <xsl:with-param name="altText" select="//rating/altDescription[../layer='general']"/>\
          </xsl:call-template>
          
passfill=\
         <xsl:call-template name="conditionalPass">\
            <xsl:with-param name="conditionalTest" select="//rating/description[../layer='general'] = 'Passed'"/>\
            <xsl:with-param name="overrideVariable">override</xsl:with-param>\
            <xsl:with-param name="text">has been</xsl:with-param>\
            <xsl:with-param name="altText">has been</xsl:with-param>\
          </xsl:call-template>
 
referfill=\
         <xsl:call-template name="conditionalFail">\
            <xsl:with-param name="conditionalTest" select="//rating/description[../layer='general'] = 'Passed'"/>\
            <xsl:with-param name="overrideVariable">override</xsl:with-param>\
            <xsl:with-param name="text">\
is \
            </xsl:with-param>\
            <xsl:with-param name="altText">xxxxxunusedxxxx</xsl:with-param>\
          </xsl:call-template> 
          
Passtxt=\
         <xsl:call-template name="conditionalPass">\
            <xsl:with-param name="conditionalTest" select="//rating/description[../layer='general'] = 'Passed'"/>\
            <xsl:with-param name="overrideVariable">override</xsl:with-param>\
            <xsl:with-param name="text">has</xsl:with-param>\
            <xsl:with-param name="altText">has</xsl:with-param>\
          </xsl:call-template>
 
Referredtxt=\
         <xsl:call-template name="conditionalFail">\
            <xsl:with-param name="conditionalTest" select="//rating/description[../layer='general'] = 'Passed'"/>\
            <xsl:with-param name="overrideVariable">override</xsl:with-param>\
            <xsl:with-param name="text">\
is considered to be\
            </xsl:with-param>\
            <xsl:with-param name="altText">xxxxxunusedxxxx</xsl:with-param>\
          </xsl:call-template>                    
 
certificatetext_Passed=\
         <xsl:call-template name="conditionalPass">\
            <xsl:with-param name="conditionalTest" select="//rating/description[../layer='general'] = 'Passed'"/>\
            <xsl:with-param name="overrideVariable">override</xsl:with-param>\
            <xsl:with-param name="text" select="//rating/code[../layer='general']"/>\
            <xsl:with-param name="altText" select="//rating/altCode[../layer='general']"/>\
          </xsl:call-template>
certificatetext_Referred=\
          <xsl:call-template name="conditionalFail">\
            <xsl:with-param name="conditionalTest" select="//rating/description[../layer='general'] = 'Passed'"/>\
            <xsl:with-param name="overrideVariable">override</xsl:with-param>\
            <xsl:with-param name="text" select="//rating/code[../layer='general']"/>\
            <xsl:with-param name="altText" select="//rating/altCode[../layer='general']"/>\
          </xsl:call-template>
          
 
		 	          
	
 
overviewtext_Passed=\
         <xsl:call-template name="conditionalPass">\
            <xsl:with-param name="conditionalTest" select="//rating/description[../layer='general'] = 'Passed'"/>\
            <xsl:with-param name="overrideVariable">override</xsl:with-param>\
            <xsl:with-param name="text">GroundSure has thoroughly reviewed the findings of this report and based on the Risk Assessment Team&apos;s review there are no significant contaminative concerns that require further consideration.</xsl:with-param>\
            <xsl:with-param name="altText">GroundSure has thoroughly reviewed the findings of this report and based on the Risk Assessment Team&apos;s review there are no significant contaminative concerns that require further consideration.</xsl:with-param>\
          </xsl:call-template>
 
overviewtext_Referred=\
         <xsl:call-template name="conditionalFail">\
            <xsl:with-param name="conditionalTest" select="//rating/description[../layer='general'] = 'Passed'"/>\
            <xsl:with-param name="overrideVariable">override</xsl:with-param>\
            <xsl:with-param name="text">\
In view of the type and location of land use disclosed by this environmental report GroundSure was initially unable to certify \
this property. An environmental consultant has gathered and reviewed additional information on the site and presented this for \
further assessment. Furthermore our Risk Assessment Team has personally reviewed the site information in detail and concluded that \
additional enquiries may help clarify this risk. Alternatively, you may wish to consider insurance as an option. If after reading this \
guidance you require further assistance please contact the Helpline. \
            </xsl:with-param>\
            <xsl:with-param name="altText">xxxxxunusedxxxx</xsl:with-param>\
          </xsl:call-template>
 
#    <!--  <xsl:when test="(//layer/feature/distance[ \
#        (../../name='LM_History' or ../../name='LM_Infilled') and ../attribute/name='Use' and \
#    	  (../attribute/value='Cemetery or Graveyard' or \
#    	  ../attribute/value='Clay bricks &amp; tiles [manufacture]' or \
#    	  ../attribute/value='Disturbed Ground' or \
#    	  ../attribute/value='Quarrying' or \
#    	  ../attribute/value='Former Marsh' or \
#    	  ../attribute/value='Unknown Filled Ground') ] &lt; 26)"> \
#      </xsl:when> \-->
 
 
NDF_AC_tag=<xsl:variable name="count" select="count(//layer/feature[../name='Tidal']) + \
                                                     count(//layer/feature[../name='Fluvial']) + \
                                                     count(//layer/feature[../name='Subsidence']) + \
                                                     count(//layer/feature[../name='Radon']) + \
                                                     count(//layer/feature[../name='Coal']) + \
                                                     count(//layer/feature[../name='LM_History']) + \
                                                     count(//layer/feature[../name='LM_Infilled']) + \
                                                     count(//layer/feature[../name='Shallow Mining'])" /> \
    <xsl:choose> \
      <xsl:when test="(//layer/feature/distance[ \
        (../../name='LM_Infilled')] &lt; 26)"> \
      </xsl:when> \
      <xsl:when test="$count = 0"></xsl:when> \
      <xsl:otherwise> \
        <xsl:choose> \
          <xsl:when test="(count(//layer/feature[../name='Tidal']) &gt; 0) and \
                          (exmath:min(//layer/feature/distance[../../name='Tidal']) &lt; 26)"> \
          </xsl:when> \
          <xsl:when test="(count(//layer/feature[../name='Fluvial']) &gt; 0) and \
                          (exmath:min(//layer/feature/distance[../../name='Fluvial']) &lt; 26)" > \
          </xsl:when> \
          <xsl:when test="(count(//layer/feature[../name='Subsidence']) &gt; 0) and \
             (count(//layer/feature/attribute/value[\
             ../../../name='Subsidence' and ../name='Score' and (. &gt; 3)] ) &gt; 0)"> \
          </xsl:when> \
          <xsl:when test="(count(//layer/feature[../name='Shallow Mining']) &gt; 0) and \
            (count(//layer/feature/attribute/value[\
            ../../../name='Shallow Mining' and ../name='CLASS' and (. &gt; 3)] ) &gt; 0)"> \
          </xsl:when> \
          <xsl:when test="(count(//layer/feature[../name='Radon']) &gt; 0) and \
            (count(//layer/feature/attribute/value[\
            ../../../name='Radon' and ../name='Score' and (. &gt; 1)] ) &gt; 0)"> \
          </xsl:when> \
          <xsl:when test="(count(//layer/feature[../name='Coal']) &gt; 0) and \
            (exmath:min(//layer/feature/distance[../../name='Coal']) &lt; 51)"> \
          </xsl:when> \
          <xsl:otherwise></xsl:otherwise> \
        </xsl:choose> \
      </xsl:otherwise> \
    </xsl:choose>
 
rattext_Tidal_Cert=\
   <xsl:if test="count(//layer/feature[../name='Tidal']) &gt; 0">\
      <xsl:if test="exmath:min(//layer/feature/distance[../../name='Tidal']) &lt; 26" >\
        The site may be at risk from Zone 2 flooding.  \
        Please refer to the Environmental Overview and Section 4.1 for further information.\
        <text:line-break/>\
      </xsl:if>\
    </xsl:if>
 
rattext_Fluvial_Cert=<xsl:if test="count(//layer/feature[../name='Fluvial']) &gt; 0">\
      <xsl:if test="exmath:min(//layer/feature/distance[../../name='Fluvial']) &lt; 26">\
        The site may be at risk from Zone 3 flooding.  \
        Please refer to the Environmental Overview and Section 4.2 for further information.\
        <text:line-break/>\
      </xsl:if>\
    </xsl:if>
 
 
    
rattext_Subsidence_Cert=\
		<xsl:variable name="maxscore" select="exmath:max(//layer/feature/attribute/value[contains(../../../name,'BGSSubsidence_') and ../../distance &lt; 51 and ../name='RANK'])"/>\
       <xsl:choose>\
        	<xsl:when test="$maxscore = 1"></xsl:when>\
          	<xsl:when test="$maxscore = 2"></xsl:when>\
			<xsl:when test="$maxscore = 3">The study site is located in an area where some properties may be affected by Natural Ground Subsidence. Please refer to the Environmental Overview and Section 5.2 for further information.<text:line-break/></xsl:when>\
          	<xsl:when test="$maxscore = 4">The study site is located in an area where some properties may be affected by Natural Ground Subsidence. Please refer to the Environmental Overview and Section 5.2 for further information.<text:line-break/></xsl:when>\
          	<xsl:when test="$maxscore = 5">The study site is located in an area where some properties may be affected by Natural Ground Subsidence. Please refer to the Environmental Overview and Section 5.2 for further information.<text:line-break/></xsl:when>\
		  	<xsl:otherwise></xsl:otherwise>\
        </xsl:choose>
            
 
rattext_Radon_Cert=<xsl:if test="count(//layer/feature[../name='Radon']) &gt; 0"> \
      <xsl:if test="count(//layer/feature/attribute/value[../../../name='Radon' \
                  and ../name='Score' and . &gt; 0] ) &gt; 0"> \
        <xsl:variable name="maxscore" select="exmath:max(//layer/feature/attribute/value[../../../name='Radon' \
                                                                                           and ../name='Score' and ../../distance=0])"/> \
        <xsl:choose> \
          <xsl:when test="$maxscore = 2"> \
            The study site is located in an area where some properties are Radon Affected.  \
            Please refer to the Environmental Overview and Section 5.3 for further information. \
            <text:line-break/>\
          </xsl:when> \
          <xsl:when test="$maxscore = 3"> \
            The study site is located in an area where some properties are Radon Affected.  \
            Please refer to the Environmental Overview and Section 5.3 for further information. \
            <text:line-break/>\
          </xsl:when> \
          <xsl:when test="$maxscore = 4"> \
            The study site is located in an area where some properties are Radon Affected.  \
            Please refer to the Environmental Overview and Section 5.3 for further information. \
            <text:line-break/>\
          </xsl:when> \
          <xsl:when test="$maxscore = 5"> \
            The study site is located in an area where some properties are Radon Affected.  \
            Please refer to the Environmental Overview and Section 5.3 for further information. \
            <text:line-break/>\
          </xsl:when> \
          <xsl:when test="$maxscore = 6"> \
            The study site is located in an area where some properties are Radon Affected.  \
            Please refer to the Environmental Overview and Section 5.3 for further information. \
            <text:line-break/>\
          </xsl:when> \
        </xsl:choose> \
      </xsl:if> \
    </xsl:if>
 
 
rattext_RadonProt_Cert=<xsl:variable name="maxscore" select="exmath:max(//layer/feature/attribute/value[../../../name='Radon' and ../name='Score' and ../../distance=0])"/> \
        <xsl:choose> \
          <xsl:when test="$maxscore = 6"> \
           <text:line-break/>The study is in an area where new developments or extensions require full radon protective measures.<text:line-break/><text:line-break/> \
           </xsl:when>\
          <xsl:when test="$maxscore = 5"> \
           <text:line-break/>The study is in an area where new developments or extensions require full radon protective measures.<text:line-break/><text:line-break/> \
           </xsl:when>\
          <xsl:when test="$maxscore = 4"> \
           <text:line-break/>The study is in an area where new developments or extensions require basic radon protective measures.<text:line-break/><text:line-break/> \
           </xsl:when>\
          <xsl:when test="$maxscore = 3"> \
           <text:line-break/>The study is in an area where new developments or extensions require basic radon protective measures.<text:line-break/><text:line-break/> \
          </xsl:when>\
        </xsl:choose>       
   
      
   
    
 
rattext_Coal_Cert=<xsl:if test="count(//layer/feature[../name='Coal']) &gt; 0"> \
      <xsl:if test="exmath:min(//layer/feature/distance[../../name='Coal']) &lt; 51"> \
        The study site lies in an area which may be affected by coal mining.  \
        Please refer to the Environmental Overview and Section 6.1 for further information. \
        <text:line-break/>\
      </xsl:if> \
    </xsl:if>
 
rattext_Shallmining_Cert=<xsl:if test="count(//layer/feature[../name='Shallow Mining']) &gt; 0"> \
      <xsl:if test="count(//layer/feature/attribute/value[../../../name='Shallow Mining' \
                  and ../name='CLASS' and . &gt; 0]) &gt; 0"> \
        <xsl:variable name="maxscore" select="exmath:max(//layer/feature/attribute/value[../../../name='Shallow Mining' \
                                                                                           and ../name='CLASS'])"/> \
        <xsl:choose> \
          <xsl:when test="$maxscore = 3"> \
            The study site is located in an area with a moderate risk of shallow mining related subsidence.  \
            Please refer to the Environmental Overview and Section 6.2 for further information. \
            <text:line-break/>\
          </xsl:when> \
          <xsl:when test="$maxscore = 4"> \
            The study site is located in an area with a moderate-high risk of shallow mining related subsidence.  \
            Please refer to the Environmental Overview and Section 6.2 for further information. \
            <text:line-break/>\
          </xsl:when> \
          <xsl:when test="$maxscore = 5"> \
            The study site is located in an area with a high risk of shallow mining related subsidence.  \
            Please refer to the Environmental Overview and Section 6.2 for further information. \
            <text:line-break/>\
          </xsl:when> \
        </xsl:choose> \
      </xsl:if> \
    </xsl:if>
 
#rattext_Structural_Cert=<xsl:if test="(//layer/feature/distance[ \
#      (../../name='LM_History' or ../../name='LM_Infilled') and ../attribute/name='Use' and \
#    	(../attribute/value='Cemetery or Graveyard' or \
#    	../attribute/value='Clay bricks &amp; tiles [manufacture]' or \
#    	../attribute/value='Disturbed Ground' or \
#    	../attribute/value='Quarrying' or \
#    	../attribute/value='Former Marsh' or \
#    	../attribute/value='Unknown Filled Ground') ] &lt; 26)"> \
#        We have identified past activities that can cause structural problems on or in proximity to the property. \
#        Please refer to the Environmental Overview section for further guidance. \
#        <text:line-break/>\
#    </xsl:if>
    
rattext_Structural_Cert=<xsl:if test="(//layer/feature/distance[(../../name='SurfaceGroundWorkings' or ../../name='UnderGroundWorkings')] &lt; 26 or \
      (//layer/feature/distance[(../../name='MiningGroundWorkings')] &lt; 501))"> \
      We have identified past activities that can cause structural problems on or in proximity to the property. \
      Please refer to the Environmental Overview section for further guidance. \
      <text:line-break/>\
    </xsl:if>
 
#rattext_Structural_Exec=<xsl:if test="(//layer/feature/distance[ \
#      (../../name='LM_History' or ../../name='LM_Infilled') and ../attribute/name='Use' and \
#    	(../attribute/value='Cemetery or Graveyard' or \
#    	../attribute/value='Clay bricks &amp; tiles [manufacture]' or \
#    	../attribute/value='Disturbed Ground' or \
#    	../attribute/value='Quarrying' or \
#    	../attribute/value='Former Marsh' or \
#    	../attribute/value='Unknown Filled Ground') ] &lt; 26)"> \
#      The study site appears to be located on or in close proximity to a past land use or area of infilled land that can cause structural problems. \
#      You may wish to check that any structural surveys performed on the property have taken this into consideration. \
#      If such factors have not been considered, you may wish to contact the local Building Regulations Officer, Planning Department and if recently constructed, the site developers. \
#      Newer developments may benefit from an NHBC guarantee or other environmental warranty which often covers structural issues. \
#      <text:line-break/><text:line-break/>\
#    </xsl:if>
 
rattext_Structural_Exec=<xsl:if test="(//layer/feature/distance[ \
      (../../name='LM_Infilled')] &lt; 26)">\
      The study site appears to be located on or in close proximity to a past land use or area of infilled land that can cause structural problems. \
      You may wish to check that any structural surveys performed on the property have taken this into consideration. \
      If such factors have not been considered, you may wish to contact the local Building Regulations Officer, Planning Department and if recently constructed, the site developers. \
      Newer developments may benefit from an NHBC guarantee or other environmental warranty which often covers structural issues. \
      <text:line-break/><text:line-break/>\
    </xsl:if>    
    
#Changed to combine both Tital and Fluvial data###
    
Flood_Guidance=\
	<xsl:variable name="CheckTidal">\
    	<xsl:choose>\
			<xsl:when test="count(//layer/feature[../name='Tidal']) &gt; 0">\
        		<xsl:variable name="distance" select="exmath:min(//layer/feature/distance[../../name='Tidal'])"/>\
        		<xsl:if test="$distance &lt; 26">Yes</xsl:if>\
        		<xsl:if test="$distance &gt; 25">No</xsl:if>\
      		</xsl:when>\
      		<xsl:otherwise>No</xsl:otherwise>\
    	</xsl:choose>\
	</xsl:variable>\
	<xsl:variable name="CheckFluvial">\
		<xsl:choose>\
      		<xsl:when test="count(//layer/feature[../name='Fluvial']) &gt; 0">\
        		<xsl:variable name="distance" select="exmath:min(//layer/feature/distance[../../name='Fluvial'])"/>\
        		<xsl:if test="$distance &lt; 26">Yes</xsl:if>\
        		<xsl:if test="$distance &gt; 25">No</xsl:if>\
      		</xsl:when>\
      		<xsl:otherwise>No</xsl:otherwise>\
    	</xsl:choose>\
	</xsl:variable>\
	<xsl:choose>\
		<xsl:when test="$CheckFluvial = 'Yes'">\
			The study site lies on or within 25m of indicative Zone 2 and Zone 3 floodplains. More detailed information may be available \
        	from the Environment Agency through their Floodline (0845 988 1188) or by ordering a Flood Report (cost of £50 excl. VAT) \
        	from the local Environment Agency Office. This normally takes 5-10 working days to prepare.  To avoid \
        	confusion and time delays you are advised to enclose a site plan and ask any specific questions that may be \
        	applicable.  You are also advised to check with your insurance company to ensure that house buildings and \
        	contents cover, which includes flood damage, is available for the property. \
        	Please note that the property may benefit from flood defences which protect many areas; flood defences do \
        	not remove the risk of flooding but they do reduce it. They are built to withstand a certain level of flood \
        	but can fail in extreme weather conditions. Defences are built according to local needs. Details of any flood \
        	defences (if present) are presented on the Natural Hazards map within this report.\
        </xsl:when>\
		<xsl:when test="$CheckTidal = 'Yes'">\
			The study site lies on or within 25m of an indicative Zone 2 floodplain. \
        	More detailed information may be available from the Environment Agency through their Floodline (0845 988 1188) \
        	or by ordering a Flood Report (cost of £50 excl. VAT) from the local Environment Agency Office.  \
        	This normally takes 5-10 working days to prepare.  \
        	To avoid confusion and time delays you are advised to enclose a site plan and ask any specific questions \
        	that may be applicable.  \
        	You are also advised to check with your insurance company to ensure that house buildings and contents cover, \
        	which includes flood damage, is available for the property. \
        	Please note that the property may benefit from flood defences which protect many areas; flood defences do \
        	not remove the risk of flooding but they do reduce it. They are built to withstand a certain level of flood \
        	but can fail in extreme weather conditions. Defences are built according to local needs. Details of any flood \
        	defences (if present) are presented on the Natural Hazards map within this report.\
        </xsl:when>\
		<xsl:otherwise>\
			The study site does not lie on or within 25m of indicative Zone 2 or 3 floodplains. This does not necessarily \
			mean that the site is free from any flood risk as local hydrological conditions may present a minor risk. You are advised \
			to check with your surveyor regarding the potential for such flooding and to refer to the mapping at the back of this report \
			to ascertain the precise location of any floodplains, if any, within the immediate area. Please not that a map is only provided \
			when a floodplain is identified within 25m of the property.\
		</xsl:otherwise>\
	</xsl:choose>
 
rattext_Tidal_Exec=<xsl:if test="count(//layer/feature[../name='Tidal']) &gt; 0"> \
      <xsl:if test="exmath:min(//layer/feature/distance[../../name='Tidal']) &lt; 26"> \
        The study site lies on or within 25m of an indicative Zone 2 floodplain. \
        More detailed information may be available from the Environment Agency through their Floodline (0845 988 1188) \
        or by ordering a Flood Report (cost of £50 excl. VAT) from the local Environment Agency Office.  \
        This normally takes 5-10 working days to prepare.  \
        To avoid confusion and time delays you are advised to enclose a site plan and ask any specific questions \
        that may be applicable.  \
        You are also advised to check with your insurance company to ensure that house buildings and contents cover, \
        which includes flood damage, is available for the property. \
        Please note that the property may benefit from flood defences which protect many areas; flood defences do \
        not remove the risk of flooding but they do reduce it. They are built to withstand a certain level of flood \
        but can fail in extreme weather conditions. Defences are built according to local needs. Details of any flood \
        defences (if present) are presented on the Natural Hazards map within this report.\
        <text:line-break/>\
      </xsl:if> \
    </xsl:if>
    
rattext_Fluvial_Exec=<xsl:if test="count(//layer/feature[../name='Fluvial']) &gt; 0"> \
      <xsl:if test="exmath:min(//layer/feature/distance[../../name='Fluvial']) &lt; 26"> \
        The study site lies on or within 25m of an indicative Zone 3 floodplain. More detailed information may be available \
        from the Environment Agency through their Floodline (0845 988 1188) or by ordering a Flood Report (cost of £50 excl. VAT) \
        from the local Environment Agency Office. This normally takes 5-10 working days to prepare.  To avoid \
        confusion and time delays you are advised to enclose a site plan and ask any specific questions that may be \
        applicable.  You are also advised to check with your insurance company to ensure that house buildings and \
        contents cover, which includes flood damage, is available for the property. \
        Please note that the property may benefit from flood defences which protect many areas; flood defences do \
        not remove the risk of flooding but they do reduce it. They are built to withstand a certain level of flood \
        but can fail in extreme weather conditions. Defences are built according to local needs. Details of any flood \
        defences (if present) are presented on the Natural Hazards map within this report.\
        <text:line-break/>\
      </xsl:if> \
    </xsl:if>
    
    
    
rattext_Shallmining_Exec=\
  <xsl:variable name="maxscore" select="exmath:max(//layer/feature/attribute/value[../../../name='Shallow Mining' and ../name='CLASS'])"/> \
        <xsl:choose>\
          <xsl:when test="$maxscore = 2">Where low-moderate potential for shallow mining is indicated, this means that the rocks underlying the area are of a type known to have been mined at shallow depth in some parts of the UK, and that such working may be possible in your area. In these cases it is recommended that you seek further advice from a Royal Institute Chartered Surveyor (RICS), the local Building Control Officer, or by ordering a Geological Report from the BGS. It is also recommended that you obtain a Coal Authority mining search, which will provide a comprehensive search of former mining activity, including coal mining at deeper levels.\
          </xsl:when>\
          <xsl:when test="$maxscore = 3">Where moderate potential for shallow mining is indicated, this means that the rocks underlying the area are of a type known to have been mined at shallow depth in some parts of the UK, and that such working may be possible in your area. In these cases it is recommended that you seek further advice from a Royal Institute Chartered Surveyor (RICS), the local Building Control Officer, or by ordering a Geological Report from the BGS. It is also recommended that you obtain a Coal Authority mining search, which will provide a comprehensive search of former mining activity, including coal mining at deeper levels.\
          </xsl:when>\
          <xsl:when test="$maxscore = 4">Where moderate-high potential for shallow mining is indicated, this means that the rocks underlying the area are of a type known to have been mined at shallow depth in some parts of the UK, and that such working may be possible in your area. In these cases it is recommended that you seek further advice from a Royal Institute Chartered Surveyor (RICS), the local Building Control Officer, or by ordering a Geological Report from the BGS. It is also recommended that you obtain a Coal Authority mining search, which will provide a comprehensive search of former mining activity, including coal mining at deeper levels.\
          </xsl:when>\
          <xsl:when test="$maxscore = 5">Shallow Mining Level 5 not applicable in UK \
          </xsl:when>\
        <xsl:otherwise>None required.</xsl:otherwise>\
          </xsl:choose>
 
    
 
    
rattext_Subsidence_Exec=\
		<xsl:variable name="maxscore" select="exmath:max(//layer/feature/attribute/value[contains(../../../name,'BGSSubsidence_') and ../../distance &lt; 51 and ../name='RANK'])"/>\
       <xsl:choose>\
        	<xsl:when test="$maxscore = 1">None Required.</xsl:when>\
          	<xsl:when test="$maxscore = 2">None Required.</xsl:when>\
			<xsl:when test="$maxscore = 3">The BGS have identified a low potential for Natural Ground Instability. This means that there is some potential for natural ground movement to occur but that is only likely to be of concern if significant changes are made to the ground or use of it. For example, this could include planting trees, changing drainage or building work - before doing anything like this you should seek professional advice.</xsl:when>\
          	<xsl:when test="$maxscore = 4">The BGS have identified a moderate potential for Natural Ground Instability. This means that there is the potential for natural ground movement to occur that may be of concern. Such ground movement could cause damage to domestic or other properties. However, properties designed, constructed and maintained in compliance with modern building regulations should be unaffected by most minor subsidence.  If thinking of buying a property in the area, you should seek professional advice from a professional property surveyor and also look at the property yourself in more detail to look for any signs of existing damage. If you already own a property in the area, and you think natural ground movement may have damaged it, you should contact your insurance company for advice. You should also take professional advice before changing the ground in any way, for example, by planting or removing trees, changing drainage or carrying out building work.</xsl:when>\
          	<xsl:when test="$maxscore = 5">The BGS have identified a high potential for Natural Ground Instability. This means that there is the potential for natural ground movement to occur that may be of concern. Such ground movement could cause damage to domestic or other properties. However, properties designed, constructed and maintained in compliance with modern building regulations should be unaffected by most minor subsidence.  If thinking of buying a property in the area, you should seek professional advice from a professional property surveyor and also look at the property yourself in more detail to look for any signs of existing damage. If you already own a property in the area, and you think natural ground movement may have damaged it, you should contact your insurance company for advice. You should also take professional advice before changing the ground in any way, for example, by planting or removing trees, changing drainage or carrying out building work.</xsl:when>\
		  	<xsl:otherwise>None required.</xsl:otherwise>\
        </xsl:choose>
        
    
 
rattext_Radon_Exec=<xsl:if test="count(//layer/feature[../name='Radon']) &gt; 0"> \
      <xsl:if test="count(//layer/feature/attribute/value[../../../name='Radon' \
                  and ../name='Score' and . &gt; 0]) &gt; 0"> \
        <xsl:variable name="maxscore" select="exmath:max(//layer/feature/attribute/value[../../../name='Radon' \
                                                                                           and ../name='Score' and ../../distance=0])"/> \
        <xsl:choose> \
          <xsl:when test="$maxscore = 2"> \
            The property is located in an area where 1-3% of houses may be Radon Affected.  The Health Protection Agency (HPA) therefore \
            recommend undertaking a site-specific Radon assessment after purchase (£39.95 incl. VAT).  \
            This provides a reading of the Radon level at the property.  If remedial measures were required, \
            these are not usually extensive and normally a provision of £1,000 to £2,000 towards these works would be sufficient. \
            This could be achieved by means of a Radon Bond (an agreed sum of money provided by a vendor which is returned \
            if further assessment shows Radon levels are low).\
          </xsl:when> \
          <xsl:when test="$maxscore = 3"> \
            The property is located in an area where 3-5% of houses may be Radon Affected.  The Health Protection Agency (HPA) therefore \
            recommend undertaking a site-specific Radon assessment after purchase (£39.95 incl. VAT).  \
            This provides a reading of the Radon level at the property.  If remedial measures were required, \
            these are not usually extensive and normally a provision of £1,000 to £2,000 towards these works would be sufficient. \
            This could be achieved by means of a Radon Bond (an agreed sum of money provided by a vendor which is returned \
            if further assessment shows Radon levels are low).\
          </xsl:when> \
          <xsl:when test="$maxscore = 4"> \
            The property is located in an area where 5-10% of houses may be Radon Affected.  The Health Protection Agency (HPA) therefore \
            recommend undertaking a site-specific Radon assessment after purchase (£39.95 incl. VAT).  \
            This provides a reading of the Radon level at the property.  If remedial measures were required, \
            these are not usually extensive and normally a provision of £1,000 to £2,000 towards these works would be sufficient. \
            This could be achieved by means of a Radon Bond (an agreed sum of money provided by a vendor which is returned \
            if further assessment shows Radon levels are low).\
          </xsl:when> \
          <xsl:when test="$maxscore = 5"> \
            The property is located in an area where 10-30% of houses may be Radon Affected.  The Health Protection Agency (HPA) therefore \
            recommend undertaking a site-specific Radon assessment after purchase (£39.95 incl. VAT).  \
            This provides a reading of the Radon level at the property.  If remedial measures were required, \
            these are not usually extensive and normally a provision of £1,000 to £2,000 towards these works would be sufficient. \
            This could be achieved by means of a Radon Bond (an agreed sum of money provided by a vendor which is returned \
            if further assessment shows Radon levels are low).\
          </xsl:when> \
          <xsl:when test="$maxscore = 6"> \
            The property is located in an area where more than 30% of houses may be Radon Affected.  The Health Protection Agency (HPA) therefore \
            recommend undertaking a site-specific Radon assessment after purchase (£39.95 incl. VAT).  \
            This provides a reading of the Radon level at the property.  If remedial measures were required, \
            these are not usually extensive and normally a provision of £1,000 to £2,000 towards these works would be sufficient. \
            This could be achieved by means of a Radon Bond (an agreed sum of money provided by a vendor which is returned \
            if further assessment shows Radon levels are low).\
          </xsl:when> \
         <xsl:otherwise>None required.</xsl:otherwise>\
          </xsl:choose> \
      </xsl:if> \
    </xsl:if>
   
 
rattext_RadonProt_Exec=<xsl:variable name="maxscore" select="exmath:max(//layer/feature/attribute/value[../../../name='Radon' and ../name='Score' and ../../distance=0])"/>\
        <xsl:choose> \
          <xsl:when test="$maxscore = 6">\
            If the property is a new development or if extension works to an older dwelling are proposed, \
            full Radon protection may be required.  These may include subfloor ventilation or the installation \
            of fans or sumps.  We would advise consulting the following publication &apos;BR211 Radon: Guidance \
            on protective measures for new dwellings or contacting the local Buildings Regulations Officer \
            for further advice.  If the site is a new development, ask the developer whether a radon assessment has \
            been carried out and whether any Radon protection has been installed.\
          </xsl:when> \
          <xsl:when test="$maxscore = 5">\
            If the property is a new development or if extension works to an older dwelling are proposed, \
            full Radon protection may be required.  These may include subfloor ventilation or the installation \
            of fans or sumps.  We would advise consulting the following publication &apos;BR211 Radon: Guidance \
            on protective measures for new dwellings or contacting the local Buildings Regulations Officer \
            for further advice.  If the site is a new development, ask the developer whether a radon assessment has \
            been carried out and whether any Radon protection has been installed.\
          </xsl:when> \
          <xsl:when test="$maxscore = 4">\
            If the property is a new development or if extension works to an older dwelling are proposed, basic \
            Radon protection may be required.  These may include subfloor ventilation or the installation of fans \
            or sumps.  We would advise consulting the following publication &apos;BR211 Radon: Guidance on \
            protective measures for new dwellings or contacting the local Buildings Regulations Officer for \
            further advice.  If the site is a new development, ask the developer whether a radon assessment has \
            been carried out and whether any Radon protection has been installed.\
          </xsl:when> \
          <xsl:when test="$maxscore = 3">\
            If the property is a new development or if extension works to an older dwelling are proposed, basic \
            Radon protection may be required.  These may include subfloor ventilation or the installation of fans \
            or sumps.  We would advise consulting the following publication &apos;BR211 Radon: Guidance on \
            protective measures for new dwellings or contacting the local Buildings Regulations Officer for \
            further advice.  If the site is a new development, ask the developer whether a radon assessment has \
            been carried out and whether any Radon protection has been installed.\
          </xsl:when> \
         <xsl:otherwise>No Radon protection measures  are required.</xsl:otherwise>\
          </xsl:choose>
   
    
 
# rattext_Coal_Exec=<xsl:if test="count(//layer/feature[../name='Coal']) &gt; 0"> \
#       <xsl:if test="exmath:min(//layer/feature/distance[../../name='Coal']) &lt; 51"> \
#         The study site is located in an area which may be affected by surface or sub-surface coal mining.  \
#         A Coal Mining Search is recommended. \
#         This can be ordered through the Coal Authority or your preferred search provider. \
#         <text:line-break/><text:line-break/>\
#      </xsl:if> \
#     </xsl:if>
 
rattext_Coal_Exec=<xsl:choose> \
      <xsl:when test="count(//layer/feature[../name='Coal']) &gt; 0"> \
        <xsl:variable name="coal" select="exmath:min(//layer/feature/distance[../../name='Coal'])"/> \
        <xsl:if test="$coal &gt; 51">None required.</xsl:if> \
        <xsl:if test="$coal &lt; 51">\
        The study site is located in an area which may be affected by surface or sub-surface coal mining.  \
        A Coal Mining Search is recommended. \
        This can be ordered through the Coal Authority or your preferred search provider. \
        </xsl:if> \
      </xsl:when> \
       <xsl:otherwise>None required.</xsl:otherwise>\
      </xsl:choose>    
 
# <!-- LM_ when test from below     <xsl:when test="(//layer/feature/distance[ \
#        (../../name='LM_History' or ../../name='LM_Infilled') and ../attribute/name='Use' and \
#    	  (../attribute/value='Cemetery or Graveyard' or \
#    	  ../attribute/value='Clay bricks &amp; tiles [manufacture]' or \
#    	  ../attribute/value='Disturbed Ground' or \
#    	  ../attribute/value='Quarrying' or \
#    	  ../attribute/value='Former Marsh' or \
#    	  ../attribute/value='Unknown Filled Ground') ] &lt; 26)"> \
#      </xsl:when> \   -->
    
    
extra_factors_tag=\
<xsl:variable name="maxscore" select="exmath:max(//layer/feature/attribute/value[contains(../../../name,'BGSSubsidence_') and ../../distance &lt; 51 and ../name='RANK'])"/>\
<xsl:variable name="Distance"> \
		<xsl:for-each select="//layer/feature/distance[contains(../../name,'FDB_')]"> \
			<xsl:sort data-type="number" order="ascending"/> \
			<xsl:if test="position()=1"> \
				<xsl:value-of select="."/> \
			</xsl:if> \
		</xsl:for-each> \
	</xsl:variable> \
<xsl:variable name="Verdict" select="//feature[contains(../name,'FDB_') and distance=$Distance]/attribute/value[../name='Verdict']"/> \
<xsl:variable name="count" select="count(//layer/feature[../name='Tidal']) + \
                                                     count(//layer/feature[../name='Fluvial']) + \
                                                     count(//layer/feature[contains(../name,'BGSSubsidence_')]) + \
                                                     count(//layer/feature[contains(../name,'FDB_')]) + \
                                                     count(//layer/feature[../name='Radon']) + \
                                                     count(//layer/feature[../name='Coal']) + \
                                                     count(//layer/feature[../name='Shallow Mining'])" /> \
    <xsl:choose> \
      <xsl:when test="(//layer/feature/distance[ \
        (../../name='LM_Infilled')] &lt; 26)"> \
      </xsl:when> \
      <xsl:when test="$count = 0">#DELETE#</xsl:when> \
      <xsl:otherwise> \
        <xsl:choose> \
          <xsl:when test="(count(//layer/feature[../name='Tidal']) &gt; 0) and \
                          (exmath:min(//layer/feature/distance[../../name='Tidal']) &lt; 26)"> \
          </xsl:when> \
          <xsl:when test="(count(//layer/feature[../name='Fluvial']) &gt; 0) and \
                          (exmath:min(//layer/feature/distance[../../name='Fluvial']) &lt; 26)" > \
          </xsl:when> \
          <xsl:when test="(count(//layer/feature[../name='Subsidence']) &gt; 0) and \
             (count(//layer/feature/attribute/value[\
             ../../../name='Subsidence' and ../name='Score' and (. &gt; 3)] ) &gt; 0)"> \
          </xsl:when> \
          <xsl:when test="(count(//layer/feature[../name='Shallow Mining']) &gt; 0) and \
            (count(//layer/feature/attribute/value[\
            ../../../name='Shallow Mining' and ../name='CLASS' and (. &gt; 3)] ) &gt; 0)"> \
          </xsl:when> \
          <xsl:when test="(count(//layer/feature[../name='Radon']) &gt; 0) and \
            (count(//layer/feature/attribute/value[\
            ../../../name='Radon' and ../name='Score' and (. &gt; 1)] ) &gt; 0)"> \
          </xsl:when> \
          <xsl:when test="(count(//layer/feature[../name='Coal']) &gt; 0) and \
            (exmath:min(//layer/feature/distance[../../name='Coal']) &lt; 51)"> \
          </xsl:when> \
          <xsl:when test="$maxscore = 3"></xsl:when>\
          <xsl:when test="$maxscore = 4"></xsl:when>\
          <xsl:when test="$maxscore = 5"></xsl:when>\
          <xsl:when test="$Verdict = 'R'"></xsl:when> \
          <xsl:when test="$Verdict = '5A'"></xsl:when> \
          <xsl:when test="$Verdict = '6A'"></xsl:when> \
          <xsl:when test="$Verdict = '7A' "></xsl:when> \
          <xsl:when test="$Verdict = '8A'"></xsl:when> \
          <xsl:when test="$Verdict = '9A'"></xsl:when> \
          <xsl:when test="$Verdict = '10A'"></xsl:when> \
          <xsl:when test="$Verdict = '11G'"></xsl:when> \
          <xsl:when test="$Verdict = '12P'"></xsl:when> \
          <xsl:when test="$Verdict = '13N'"></xsl:when> \
          <xsl:otherwise>#DELETE#</xsl:otherwise> \
        </xsl:choose> \
      </xsl:otherwise> \
    </xsl:choose>
 
# <!-- LM_ when test from below     <xsl:when test="(//layer/feature/distance[ \
#        (../../name='LM_History' or ../../name='LM_Infilled') and ../attribute/name='Use' and \
#    	  (../attribute/value='Cemetery or Graveyard' or \
#    	  ../attribute/value='Clay bricks &amp; tiles [manufacture]' or \
#    	  ../attribute/value='Disturbed Ground' or \
#    	  ../attribute/value='Quarrying' or \
#    	  ../attribute/value='Former Marsh' or \
#    	  ../attribute/value='Unknown Filled Ground') ] &lt; 26)"> \
#      </xsl:when> \   -->
#FROM HERE    
extra_factors_tag_EASummary=<xsl:variable name="count" select="count(//layer/feature[../name='Subsidence']) + \
                                                     count(//layer/feature[../name='Radon']) + \
                                                     count(//layer/feature[../name='Coal']) + \
                                                     count(//layer/feature[../name='Shallow Mining'])" /> \
    <xsl:choose> \
      <xsl:when test="(//layer/feature/distance[ \
        (../../name='LM_Infilled')] &lt; 26)"> \
      </xsl:when> \
      <xsl:when test="$count = 0">#DELETE#</xsl:when> \
      <xsl:otherwise> \
        <xsl:choose> \
          <xsl:when test="(count(//layer/feature[../name='Subsidence']) &gt; 0) and \
             (count(//layer/feature/attribute/value[\
             ../../../name='Subsidence' and ../name='Score' and (. &gt; 3)] ) &gt; 0)"> \
          </xsl:when> \
          <xsl:when test="(count(//layer/feature[../name='Shallow Mining']) &gt; 0) and \
            (count(//layer/feature/attribute/value[\
            ../../../name='Shallow Mining' and ../name='CLASS' and (. &gt; 3)] ) &gt; 0)"> \
          </xsl:when> \
          <xsl:when test="(count(//layer/feature[../name='Radon']) &gt; 0) and \
            (count(//layer/feature/attribute/value[\
            ../../../name='Radon' and ../name='Score' and (. &gt; 1)] ) &gt; 0)"> \
          </xsl:when> \
          <xsl:when test="(count(//layer/feature[../name='Coal']) &gt; 0) and \
            (exmath:min(//layer/feature/distance[../../name='Coal']) &lt; 51)"> \
          </xsl:when> \
          <xsl:otherwise>#DELETE#</xsl:otherwise> \
        </xsl:choose> \
      </xsl:otherwise> \
    </xsl:choose>    
    			
rattext_Tidal=\
          <xsl:call-template name="conditional">\
            <xsl:with-param name="conditionalTest" select="count(//rating/altCode[../layer='Tidal']) = 0"/>\
            <xsl:with-param name="overrideVariable">override</xsl:with-param>\
            <xsl:with-param name="text" select="//rating/code[../layer='Tidal']"/>\
            <xsl:with-param name="altText" select="//rating/altCode[../layer='Tidal']"/>\
          </xsl:call-template>
 
rattext_Fluvial=\
          <xsl:call-template name="conditional">\
            <xsl:with-param name="conditionalTest" select="count(//rating/altCode[../layer='Fluvial']) = 0"/>\
            <xsl:with-param name="overrideVariable">override</xsl:with-param>\
            <xsl:with-param name="text" select="//rating/code[../layer='Fluvial']"/>\
            <xsl:with-param name="altText" select="//rating/altCode[../layer='Fluvial']"/>\
          </xsl:call-template>
 
#rattext_Shallmining=\
#          <xsl:call-template name="conditional">\
#            <xsl:with-param name="conditionalTest" select="count(//rating/altCode[../layer='Shallow Mining']) = 0"/>\
#            <xsl:with-param name="overrideVariable">override</xsl:with-param>\
#            <xsl:with-param name="text" select="//rating/code[../layer='Shallow Mining']"/>\
#            <xsl:with-param name="altText" select="//rating/altCode[../layer='Shallow Mining']"/>\
#          </xsl:call-template>
 
 
 
 
rattext_Shallmining=\
  <xsl:variable name="maxscore" select="exmath:max(//layer/feature/attribute/value[../../../name='Shallow Mining' and ../name='CLASS'])"/> \
        <xsl:choose>\
          <xsl:when test="$maxscore = 1">Where low potential is indicated, this means that the rocks underlying the area are of a type known to have been mined at shallow depth in some parts of the UK, but that it is unlikely to be of significant concern in this area. However, it is recommended that you do obtain a Coal Authority mining search in this area, which will provide a comprehensive search of former mining activity, including coal mining at deeper levels. \
          </xsl:when>\
          <xsl:when test="$maxscore = 2">Where low-moderate potential is indicated, this means that the rocks underlying the area are of a type known to have been mined at shallow depth in some parts of the UK, and that such working may be possible in your area. In these cases it is recommended that you seek further advice from a Royal Institute Chartered Surveyor (RICS), the local Building Control Officer, or by ordering a Geological Report from the BGS. It is also recommended that you obtain a Coal Authority mining search, which will provide a comprehensive search of former mining activity, including coal mining at deeper levels. \
          </xsl:when>\
          <xsl:when test="$maxscore = 3">Where moderate potential is indicated, this means that the rocks underlying the area are of a type known to have been mined at shallow depth in some parts of the UK, and that such working may be possible in your area. In these cases it is recommended that you seek further advice from a Royal Institute Chartered Surveyor (RICS), the local Building Control Officer, or by ordering a Geological Report from the BGS. It is also recommended that you obtain a Coal Authority mining search, which will provide a comprehensive search of former mining activity, including coal mining at deeper levels. \
          </xsl:when>\
          <xsl:when test="$maxscore = 4">Where moderate-high potential is indicated, this means that the rocks underlying the area are of a type known to have been mined at shallow depth in some parts of the UK, and that such working may be possible in your area. In these cases it is recommended that you seek further advice from a Royal Institute Chartered Surveyor (RICS), the local Building Control Officer, or by ordering a Geological Report from the BGS. It is also recommended that you obtain a Coal Authority mining search, which will provide a comprehensive search of former mining activity, including coal mining at deeper levels. \
          </xsl:when>\
          <xsl:when test="$maxscore = 5">Not applicable in UK \
          </xsl:when>\
          <xsl:otherwise>Where negligible potential is indicated, this means that the rocks underlying the area are not likely to have been mined at shallow depth. However, you should still find out whether or not a Coal Authority mining search is required in the area, for example, to check for deeper mining.</xsl:otherwise>\
        </xsl:choose>
          
#B4 changes to look at 6 BGS datasets        
#rattext_Subsidence=\
#          <xsl:call-template name="conditional">\
#            <xsl:with-param name="conditionalTest" select="count(//rating/altCode[../layer='Subsidence']) = 0"/>\
#            <xsl:with-param name="overrideVariable">override</xsl:with-param>\
#            <xsl:with-param name="text" select="//rating/code[../layer='Subsidence']"/>\
#            <xsl:with-param name="altText" select="//rating/altCode[../layer='Subsidence']"/>\
#          </xsl:call-template>
 
rattext_Subsidence=\
		<xsl:variable name="maxscore" select="exmath:max(//layer/feature/attribute/value[contains(../../../name,'BGSSubsidence_') and ../../distance &lt; 51 and ../name='RANK'])"/>\
        <xsl:choose>\
        	<xsl:when test="$maxscore = 1">Where negligible potential is indicated, this means that you need take no further action in relation to natural ground subsidence in this area.</xsl:when>\
          	<xsl:when test="$maxscore = 2">Where very low potential is indicated, this means that you need take no further action in relation to natural ground subsidence in this area.</xsl:when>\
			<xsl:when test="$maxscore = 3">Where low potential is indicated, this means that there is some potential for natural ground movement to occur but that it is only likely to be of concern if significant changes are made to the ground or use of it. For example, this could include planting trees, changing drainage or building work  before doing anything like this you should seek professional advice.</xsl:when>\
          	<xsl:when test="$maxscore = 4">Where moderate potential is indicated, this means that there is the potential for natural ground movement to occur that may be of concern. Such ground movement could cause damage to domestic or other properties. However, properties designed, constructed and maintained in compliance with modern building regulations should be unaffected by most minor subsidence.  If thinking of buying a property in the area, you should seek professional advice from a professional property surveyor and also look at the property yourself in more detail to look for any signs of existing damage. If you already own a property in the area, and you think natural ground movement may have damaged it, you should contact your insurance company for advice. You should also take professional advice before changing the ground in any way, for example, by planting or removing trees, changing drainage or carrying out building work.</xsl:when>\
          	<xsl:when test="$maxscore = 5">Where high potential is indicated, this means that there is the potential for natural ground movement to occur that may be of concern. Such ground movement could cause damage to domestic or other properties. However, properties designed, constructed and maintained in compliance with modern building regulations should be unaffected by most minor subsidence.  If thinking of buying a property in the area, you should seek professional advice from a professional property surveyor and also look at the property yourself in more detail to look for any signs of existing damage. If you already own a property in the area, and you think natural ground movement may have damaged it, you should contact your insurance company for advice. You should also take professional advice before changing the ground in any way, for example, by planting or removing trees, changing drainage or carrying out building work.</xsl:when>\
		  	<xsl:otherwise>Where negligible potential is indicated, this means that you need take no further action in relation to natural ground subsidence in this area.</xsl:otherwise>\
        </xsl:choose>
 
 
rattext_Radon=\
          <xsl:call-template name="conditional">\
            <xsl:with-param name="conditionalTest" select="count(//rating/altCode[../layer='Radon']) = 0"/>\
            <xsl:with-param name="overrideVariable">override</xsl:with-param>\
            <xsl:with-param name="text" select="//rating/code[../layer='Radon']"/>\
            <xsl:with-param name="altText" select="//rating/altCode[../layer='Radon']"/>\
          </xsl:call-template>
 
rattext_RadonProt=<xsl:variable name="maxscore" select="exmath:max(//layer/feature/attribute/value[../../../name='Radon' and ../name='Score' and ../../distance=0])"/>\
        <xsl:choose>\
          <xsl:when test="$maxscore = 6">\
           Radon is a colourless, odourless radioactive gas which is present in all areas of the United Kingdom, \
           usually at levels that pose a negligible risk to homebuyers.  However, in some areas levels of radon are much higher \
           than in others, and in these cases it can pose a health risk. The data supplied by the Health Protection Agency (HPA) \
           and the British Geological Survey (BGS) is not able to determine exact Radon levels, as this information can only be obtained \
           through site-specific, in-situ testing.  As more than 30% of properties in the area may be radon affected the HPA recommend carrying \
           out a site-specific radon assessment.  This costs £39.95 including VAT and the results are confidential to the client.  \
           Please contact the HPA (01235 831 600) for further information and advice.\
           <text:line-break/><text:line-break/>\
           If planning on building an extension or a new build property full radon protective measures \
           will need to be installed in accordance with the Building Research Establishment guidance on radon \
           protective measures for new dwellings (BR211 2007).\
          </xsl:when>\
          <xsl:when test="$maxscore = 5">\
           Radon is a coslourless, odourless radioactive gas which is present in all areas of the United Kingdom, \
           usually at levels that pose a negligible risk to homebuyers.  However, in some areas levels of radon are \
           much higher than in others, and in these cases it can pose a health risk. \
           The data supplied by the Health Protection Agency (HPA) and the British Geological Survey (BGS) \
           is not able to determine exact Radon levels, as this information can only be obtained through site-specific, \
           in-situ testing. As 10-30% of properties in the area may be radon affected the HPA recommend carrying out a site-specific radon assessment.  \
           This costs £39.95 including VAT and the results are confidential to the client.  \
           Please contact the HPA (01235 831 600) for further information and advice.\
           <text:line-break/><text:line-break/>\
           If planning on building an extension or a new build property full radon protective measures \
           will need to be installed in accordance with the Building Research Establishment \
           guidance on radon protective measures for new dwellings (BR211 2007).\
          </xsl:when>\
          <xsl:when test="$maxscore = 4">\
           Radon is a colourless, odourless radioactive gas which is present in all areas of the United Kingdom, \
           usually at levels that pose a negligible risk to homebuyers.  However, in some areas levels of radon \
           are much higher than in others, and in these cases it can pose a health risk. The data supplied by the \
           Health Protection Agency (HPA) and the British Geological Survey (BGS) is not able to determine exact Radon levels, \
           as this information can only be obtained through site-specific, in-situ testing.  As 5-10% of properties in the area \
           may be radon affected the HPA recommend carrying out a site-specific radon assessment.  \
           This costs £39.95 including VAT and the results are confidential to the client.  Please contact the HPA (01235 831 600) \
           for further information and advice.\
           <text:line-break/><text:line-break/>\
           If planning on building an extension or a new build property basic radon protective measures will need \
           to be installed in accordance with the Building Research Establishment guidance on radon protective measures for new dwellings (BR211 2007).\
          </xsl:when> \
        <xsl:when test="$maxscore = 3">\
           Radon is a colourless odourless radioactive gas which is present in all areas of the United Kingdom, \
           usually at levels that pose a negligible risk to homebuyers.  However, in some areas levels of radon are \
           much higher than in others, and in these cases it can pose a health risk. \
           The data supplied by the Health Protection Agency (HPA) and the British Geological Survey (BGS) \
           is not able to determine exact Radon levels, as this information can only be obtained through site-specific, \
           in-situ testing.  As 3-5% of properties in the area may be radon affected the HPA recommend carrying out a site-specific radon assessment.  \
           This costs £39.95 including VAT and the results are confidential to the client.  \
           Please contact the HPA (01235 831 600) for further information and advice.\
           <text:line-break/><text:line-break/>\
           If planning on building an extension or a new build property basic radon protective measures will need to be installed \
           in accordance with the Building Research Establishment guidance on radon protective measures for new dwellings (BR211 2007).\
          </xsl:when>\
          <xsl:when test="$maxscore = 2">\
           Radon is a colourless, odourless radioactive gas which is present in all areas of the United Kingdom, \
           usually at levels that pose a negligible risk to homebuyers.  However, in some areas levels of radon are \
           much higher than in others, and in these cases it can pose a health risk.  The data supplied by the Health Protection Agency \
           (HPA) and the British Geological Survey (BGS) is not able to determine exact Radon levels, as this information can only be \
           obtained through site-specific, in-situ testing.  As 1-3% of properties in the area may be radon affected the HPA recommend \
           carrying out a site-specific radon assessment.  This costs £39.95 including VAT and the results are confidential to the client.  \
           Please contact the HPA (01235 831 600) for further information and advice.\
           <text:line-break/><text:line-break/>\
           If planning on building an extension or a new build property, no radon protection measures are required.\
          </xsl:when>\
          <xsl:when test="$maxscore = 1">\
           Radon is a colourless, odourless radioactive gas which is present in all areas of the United Kingdom, \
           usually at levels that pose a negligible risk to homebuyers.  However, in some areas levels of radon are \
           much higher than in others, and in these cases it can pose a health risk.  \
           The data supplied by the Health Protection Agency (HPA) and the British Geological Survey (BGS)\
           is not able to determine exact Radon levels, as this information can only be obtained through site-specific, \
           in-situ testing. As less than 1% of properties in the area may be radon affected, the HPA do not consider that further action is necessary.\
           <text:line-break/><text:line-break/>\
           The responses given on the level of radon protective measures required are based on a joint radon potential dataset from \
           the Health Protection Agency (HPA) and the British Geological Survey (BGS). \
           No radon protection measures are required for new builds or extensions.\
          </xsl:when> \
          <xsl:when test="$maxscore = 0">\
                No Data Available \
          </xsl:when> \
        </xsl:choose> 
 
rattext_Coal=\
          <xsl:call-template name="conditional">\
            <xsl:with-param name="conditionalTest" select="count(//rating/altCode[../layer='Coal']) = 0"/>\
            <xsl:with-param name="overrideVariable">override</xsl:with-param>\
            <xsl:with-param name="text" select="//rating/code[../layer='Coal']"/>\
            <xsl:with-param name="altText" select="//rating/altCode[../layer='Coal']"/>\
          </xsl:call-template>
 
 
Tidal=<xsl:choose> \
      <xsl:when test="count(//layer/feature[../name='Tidal']) &gt; 0"> \
        <xsl:variable name="distance" select="exmath:min(//layer/feature/distance[../../name='Tidal'])"/> \
        <xsl:if test="$distance &lt; 26">Yes</xsl:if> \
        <xsl:if test="$distance &gt; 25">No</xsl:if> \
      </xsl:when> \
      <xsl:otherwise>No</xsl:otherwise> \
    </xsl:choose>
 
Fluvial=<xsl:choose> \
      <xsl:when test="count(//layer/feature[../name='Fluvial']) &gt; 0"> \
        <xsl:variable name="distance" select="exmath:min(//layer/feature/distance[../../name='Fluvial'])"/> \
        <xsl:if test="$distance &lt; 26">Yes</xsl:if> \
        <xsl:if test="$distance &gt; 25">No</xsl:if> \
      </xsl:when> \
      <xsl:otherwise>No</xsl:otherwise> \
    </xsl:choose>
    
Fluvial_Tidal=\
	<xsl:variable name="CheckTidal">\
    	<xsl:choose>\
			<xsl:when test="count(//layer/feature[../name='Tidal']) &gt; 0">\
        		<xsl:variable name="distance" select="exmath:min(//layer/feature/distance[../../name='Tidal'])"/>\
        		<xsl:if test="$distance &lt; 26">Yes</xsl:if>\
        		<xsl:if test="$distance &gt; 25">No</xsl:if>\
      		</xsl:when>\
      		<xsl:otherwise>No</xsl:otherwise>\
    	</xsl:choose>\
	</xsl:variable>\
	<xsl:variable name="CheckFluvial">\
		<xsl:choose>\
      		<xsl:when test="count(//layer/feature[../name='Fluvial']) &gt; 0">\
        		<xsl:variable name="distance" select="exmath:min(//layer/feature/distance[../../name='Fluvial'])"/>\
        		<xsl:if test="$distance &lt; 26">Yes</xsl:if>\
        		<xsl:if test="$distance &gt; 25">No</xsl:if>\
      		</xsl:when>\
      		<xsl:otherwise>No</xsl:otherwise>\
    	</xsl:choose>\
	</xsl:variable>\
	<xsl:choose>\
		<xsl:when test="$CheckTidal = 'Yes'">Yes</xsl:when>\
		<xsl:otherwise>No</xsl:otherwise>\
	</xsl:choose>
	<!-- <xsl:when test="$CheckTidal = 'Yes' or $CheckFluvial = 'Yes'">Yes</xsl:when>\-->
 
AOB=<xsl:choose> \
      <xsl:when test="count(//layer/feature[../name='AOB']) &gt; 0"> \
        <xsl:variable name="distance" select="exmath:min(//layer/feature/distance[../../name='AOB'])"/> \
        <xsl:if test="$distance &lt; 26">Yes</xsl:if> \
        <xsl:if test="$distance &gt; 25">No</xsl:if> \
      </xsl:when> \
      <xsl:otherwise>No</xsl:otherwise> \
    </xsl:choose>
 
Shallmining=\
  <xsl:variable name="maxscore" select="exmath:max(//layer/feature/attribute/value[../../../name='Shallow Mining' and ../name='CLASS'])"/> \
        <xsl:choose>\
          <xsl:when test="$maxscore = 1">Low \
          </xsl:when>\
          <xsl:when test="$maxscore = 2">Low - Moderate \
          </xsl:when>\
          <xsl:when test="$maxscore = 3">Moderate \
          </xsl:when>\
          <xsl:when test="$maxscore = 4">Moderate - High \
          </xsl:when>\
          <xsl:when test="$maxscore = 5">High \
          </xsl:when>\
          <xsl:otherwise>Negligible</xsl:otherwise>\
        </xsl:choose>   
        
OtherMining=<xsl:choose> \
      <xsl:when test="count(//layer/feature[../name='Other_Mining']) &gt; 0"> \
        <xsl:variable name="distance" select="exmath:min(//layer/feature/distance[../../name='Other_Mining'])"/> \
        <xsl:if test="$distance &lt; 26">Guidance: In addition to being located inside an area where The Coal Authority have information on coal mining activities, Johnson Poole and Bloomer (JPB) have information such as mining plans and maps held within their archive of mining activities that have occurred within 1km of this property which may supplement this information. Further details can be obtained by contacting them on:- enquiries@jpb.co.uk</xsl:if> \
      </xsl:when> \
      <xsl:otherwise>Guidance: Whilst outside of an area where The Coal Authority have information on coal mining activities, Johnson Poole and Bloomer (JPB) have information such as mining plans and maps held within their archive of mining activities that have occurred within 1km of this property. Further details can be obtained by contacting them on:- enquiries@jpb.co.uk</xsl:otherwise> \
    </xsl:choose>   
 
JPB=<xsl:choose> \
      <xsl:when test="count(//layer/feature[../name='Other_Mining']) &gt; 0"> \
        <xsl:variable name="distance" select="exmath:min(//layer/feature/distance[../../name='Other_Mining'])"/> \
        <xsl:if test="$distance &lt; 26">Yes</xsl:if> \
      </xsl:when> \
      <xsl:otherwise>No</xsl:otherwise> \
    </xsl:choose>    
 
JPB_Rows=<xsl:variable name="count" select="count(//feature[../name='Other_Mining'])"/>\
  #_rows_#<xsl:choose><xsl:when test="$count &gt; 0"><xsl:value-of select="$count"/>#</xsl:when><xsl:otherwise>#DELETE#</xsl:otherwise></xsl:choose>
 
JPB_Dir=<xsl:for-each select="//feature[../name='Other_Mining']"><xsl:text>~</xsl:text>\
  <xsl:value-of select="direction"/></xsl:for-each>  
      
JPB_Dist=<xsl:for-each select="//layer/feature[../name='Other_Mining']"><xsl:text>~</xsl:text>\
  <xsl:value-of select="distance"/></xsl:for-each>
 
  
  
MiningGround500=<xsl:choose> \
      <xsl:when test="count(//layer/feature[../name='Britpits']) &lt; 501">Yes</xsl:when> \
      <xsl:otherwise>No</xsl:otherwise> \
    </xsl:choose>
        
#Mining_Ground_Fill_tag=<xsl:if test="count(//layer/feature[../name='Britpits']) = 0">Database searched and no data found.</xsl:if>
#
#MiningGroundRows=#_rows_#<xsl:variable name="count" select="count(//layer/feature[../name='Britpits'])"/> \
#           <xsl:choose> \
#           <xsl:when test="$count &gt; 0"> \
#               <xsl:value-of select="$count" /># \
#           </xsl:when> \
#           <xsl:otherwise>#DELETE#</xsl:otherwise> \
#           </xsl:choose>
#
#MiningGround_id=<xsl:for-each select="//layer/feature[../name='Britpits']">\
#  <xsl:text>~</xsl:text>\
#  <xsl:choose>\
#    <xsl:when test="substring(./@id,1,1)='X' "></xsl:when>\
#    <xsl:when test="substring(./@id,1,1)!='N' ">\
#      <xsl:value-of select="./@id"/>\
#    </xsl:when>\
#    <xsl:otherwise>Not shown</xsl:otherwise>\
#  </xsl:choose>\
#</xsl:for-each>
#
#Mining_Ground_Dist=<xsl:for-each select="//layer/feature/distance[../../name='Britpits']"><xsl:text>~</xsl:text><xsl:value-of select="."/></xsl:for-each>
#
#Mining_Ground_Dir=<xsl:for-each select="//layer/feature/direction[../../name='Britpits']"><xsl:text>~</xsl:text><xsl:value-of select="."/></xsl:for-each>
#	 
#Mining_Ground_Use=<xsl:for-each select="//layer/feature[../name='Britpits']">\
#          <xsl:text>~</xsl:text><xsl:value-of select="self::node()[../name='Commodity_produced']"/> \
#          </xsl:for-each>
#
#Mining_Ground_Date=<xsl:for-each select="//layer/feature[../name='Britpits']">\
#           <xsl:text>~</xsl:text><xsl:value-of select="self::node()[../name='DATE_UPDATED']"/> \
#           </xsl:for-each>
#
#Mining_Ground_east=<xsl:for-each select="//layer/feature[../name='Britpits']"><xsl:text>~</xsl:text>\
#<xsl:value-of select="self::node()[../name='Easting']"/> \
#<xsl:text>,</xsl:text>\
#<xsl:value-of select="../Northing"/>\
#</xsl:for-each>  
#  
#Mining_Ground_east=<xsl:for-each select="//layer/feature/Easting[../../name='Britpits']"><xsl:text>~</xsl:text>\
#<xsl:value-of select="."/>\
#<xsl:text>,</xsl:text>\
#<xsl:value-of select="../Northing"/>\
#</xsl:for-each>
  
  
Coal=<xsl:choose> \
      <xsl:when test="count(//layer/feature[../name='Coal']) &gt; 0"> \
        <xsl:variable name="distance" select="exmath:min(//layer/feature/distance[../../name='Coal'])"/> \
        <xsl:if test="$distance &lt; 51">Yes</xsl:if> \
        <xsl:if test="$distance &gt; 50">No</xsl:if> \
      </xsl:when> \
      <xsl:otherwise>No</xsl:otherwise> \
    </xsl:choose>
 
#B4 changes to combine 6 BGS datasets
#Subsidence=<xsl:choose> \
#      <xsl:when test="count(//layer/feature[../name='Subsidence']) &gt; 0" > \
#        <xsl:choose> \
#          <xsl:when test="count(//layer/feature/attribute/value[../../../name='Subsidence' and \
#                                                                    ../name='Score' and . &gt; 0]) &gt; 0"> \
#            <xsl:variable name="maxscore" select="exmath:max(//layer/feature/attribute/value[../../../name='Subsidence' \
#                                                                                           and ../name='Score'])"/> \
#            <xsl:value-of select="//layer/feature/attribute/value[../../../name='Subsidence' \
#                                                                    and ../name='SubsidenceRisk' and \
#                                     ($maxscore = ../../attribute/value[../name='Score'])][1] "/> \
#          </xsl:when> \
#          <xsl:otherwise> \
#            <xsl:value-of select="//layer/feature/attribute/value[../../../name='Subsidence' \
#                                                                    and ../name='SubsidenceRisk'][1] "/> \
#          </xsl:otherwise> \
#        </xsl:choose> \
#      </xsl:when> \
#      <xsl:otherwise> \
#      </xsl:otherwise> \
#    </xsl:choose>
 
Collapsible_Max_Haz=\
<xsl:variable name="maxscore" select="exmath:max(//layer/feature/attribute/value[contains(../../../name,'BGSSubsidence_Collapsible_') and ../../distance &lt; 51 and ../name='RANK'])"/>\
        <xsl:choose>\
          <xsl:when test="$maxscore = 0">Negligible\
          </xsl:when>\
          <xsl:when test="$maxscore = 1">Negligible\
          </xsl:when>\
          <xsl:when test="$maxscore = 2">Very Low\
          </xsl:when>\
          <xsl:when test="$maxscore = 3">Low \
          </xsl:when>\
          <xsl:when test="$maxscore = 4">Moderate\
          </xsl:when>\
          <xsl:when test="$maxscore = 5">High\
          </xsl:when>\
          <xsl:when test="$maxscore = 6">High\
          </xsl:when>\
          <xsl:otherwise>Negligible</xsl:otherwise>\
        </xsl:choose>
        
Compressibles_Max_Haz=\
<xsl:variable name="maxscore" select="exmath:max(//layer/feature/attribute/value[contains(../../../name,'BGSSubsidence_Compressible_') and ../../distance &lt; 51 and ../name='RANK'])"/>\
        <xsl:choose>\
          <xsl:when test="$maxscore = 0">Negligible\
          </xsl:when>\
          <xsl:when test="$maxscore = 1">Negligible\
          </xsl:when>\
          <xsl:when test="$maxscore = 2">Very Low\
          </xsl:when>\
          <xsl:when test="$maxscore = 3">Low \
          </xsl:when>\
          <xsl:when test="$maxscore = 4">Moderate\
          </xsl:when>\
          <xsl:when test="$maxscore = 5">High\
          </xsl:when>\
          <xsl:when test="$maxscore = 6">High\
          </xsl:when>\
          <xsl:otherwise>Negligible</xsl:otherwise>\
        </xsl:choose>         
       
        
 
ShrinkSwell_Max_Haz=\
<xsl:variable name="maxscore" select="exmath:max(//layer/feature/attribute/value[contains(../../../name,'BGSSubsidence_ShrinkSwell_') and ../../distance &lt; 51 and ../name='RANK'])"/>\
        <xsl:choose>\
          <xsl:when test="$maxscore = 0">Negligible\
          </xsl:when>\
          <xsl:when test="$maxscore = 1">Negligible\
          </xsl:when>\
          <xsl:when test="$maxscore = 2">Very Low\
          </xsl:when>\
          <xsl:when test="$maxscore = 3">Low \
          </xsl:when>\
          <xsl:when test="$maxscore = 4">Moderate\
          </xsl:when>\
          <xsl:when test="$maxscore = 5">High\
          </xsl:when>\
          <xsl:when test="$maxscore = 6">High\
          </xsl:when>\
          <xsl:otherwise>Negligible</xsl:otherwise>\
        </xsl:choose> 
        
        
SlopeInstability_Max_Haz=\
<xsl:variable name="maxscore" select="exmath:max(//layer/feature/attribute/value[contains(../../../name,'BGSSubsidence_SlopeInstability_') and ../../distance &lt; 51 and ../name='RANK'])"/>\
        <xsl:choose>\
          <xsl:when test="$maxscore = 0">Negligible\
          </xsl:when>\
          <xsl:when test="$maxscore = 1">Negligible\
          </xsl:when>\
          <xsl:when test="$maxscore = 2">Very Low\
          </xsl:when>\
          <xsl:when test="$maxscore = 3">Low \
          </xsl:when>\
          <xsl:when test="$maxscore = 4">Moderate\
          </xsl:when>\
          <xsl:when test="$maxscore = 5">High\
          </xsl:when>\
          <xsl:when test="$maxscore = 6">High\
          </xsl:when>\
          <xsl:otherwise>Negligible</xsl:otherwise>\
        </xsl:choose>        
 
        
        
Dissolution_Max_Haz=\
<xsl:variable name="maxscore" select="exmath:max(//layer/feature/attribute/value[contains(../../../name,'BGSSubsidence_Dissolution') and ../../distance &lt; 51 and ../name='RANK'])"/>\
        <xsl:choose>\
          <xsl:when test="$maxscore = 0">Negligible\
          </xsl:when>\
          <xsl:when test="$maxscore = 1">Negligible\
          </xsl:when>\
          <xsl:when test="$maxscore = 2">Very Low\
          </xsl:when>\
          <xsl:when test="$maxscore = 3">Low \
          </xsl:when>\
          <xsl:when test="$maxscore = 4">Moderate\
          </xsl:when>\
          <xsl:when test="$maxscore = 5">High\
          </xsl:when>\
          <xsl:when test="$maxscore = 6">High\
          </xsl:when>\
          <xsl:otherwise>Negligible</xsl:otherwise>\
        </xsl:choose> 
        
        
Sand_Max_Haz=\
<xsl:variable name="maxscore" select="exmath:max(//layer/feature/attribute/value[contains(../../../name,'BGSSubsidence_RunningSands') and ../../distance &lt; 51 and ../name='RANK'])"/>\
        <xsl:choose>\
          <xsl:when test="$maxscore = 0">Negligible\
          </xsl:when>\
          <xsl:when test="$maxscore = 1">Negligible\
          </xsl:when>\
          <xsl:when test="$maxscore = 2">Very Low\
          </xsl:when>\
          <xsl:when test="$maxscore = 3">Low \
          </xsl:when>\
          <xsl:when test="$maxscore = 4">Moderate\
          </xsl:when>\
          <xsl:when test="$maxscore = 5">High\
          </xsl:when>\
          <xsl:when test="$maxscore = 6">High\
          </xsl:when>\
          <xsl:otherwise>Negligible</xsl:otherwise>\
        </xsl:choose>                                                            
 
#### NEW NDF tags
  
NDF_Collapsible_pass=\
  <xsl:choose>\
    <xsl:when test="count(//feature[../name='Collapsible' and distance &lt; 51 and (CLASS ='D' or CLASS ='E')]) &gt; 0">In Need of Further Assessment</xsl:when>\
    <xsl:otherwise>\
      Passed \
    </xsl:otherwise>\
  </xsl:choose>
  
NDF_Compressibles_pass=\
  <xsl:choose>\
    <xsl:when test="count(//feature[../name='Compressibles' and distance &lt; 51 and (CLASS ='D' or CLASS ='E')]) &gt; 0">In Need of Further Assessment</xsl:when>\
    <xsl:otherwise>\
      Passed \
    </xsl:otherwise>\
  </xsl:choose>  
  
NDF_Dissolution_pass=\
  <xsl:choose>\
    <xsl:when test="count(//feature[../name='Dissolution' and distance &lt; 51 and (CLASS ='D' or CLASS ='E')]) &gt; 0">In Need of Further Assessment</xsl:when>\
    <xsl:otherwise>\
      Passed \
    </xsl:otherwise>\
  </xsl:choose>  
  
NDF_RunningSands_pass=\
  <xsl:choose>\
    <xsl:when test="count(//feature[../name='RunningSands' and distance &lt; 51 and (CLASS ='D' or CLASS ='E')]) &gt; 0">In Need of Further Assessment</xsl:when>\
    <xsl:otherwise>\
      Passed \
    </xsl:otherwise>\
  </xsl:choose>   
  
NDF_ShrinkSwell_pass=\
  <xsl:choose>\
    <xsl:when test="count(//feature[../name='ShrinkSwell' and distance &lt; 51 and (CLASS ='D' or CLASS ='E')]) &gt; 0">In Need of Further Assessment</xsl:when>\
    <xsl:otherwise>\
      Passed \
    </xsl:otherwise>\
  </xsl:choose> 
  
NDF_SlopeInstability_pass=\
  <xsl:choose>\
    <xsl:when test="count(//feature[contains(../name,'SlopeInstability') and distance &lt; 51 and (CLASS ='D' or CLASS ='E')]) &gt; 0">In Need of Further Assessment</xsl:when>\
    <xsl:otherwise>\
      Passed \
    </xsl:otherwise>\
  </xsl:choose>      
 
  
########################################################
 
Collapsible_Risk_Max=\
<xsl:variable name="maxscore" select="exmath:max(//layer/feature/attribute/value[contains(../../../name,'BGSSubsidence_Collapsible_') and ../../distance &lt; 51 and ../name='RANK'])"/>\
        <xsl:choose>\
          <xsl:when test="$maxscore = 0">No indicators for collapsible deposits identified. No special actions required to avoid problems due to collapsible deposits.\
          </xsl:when>\
          <xsl:when test="$maxscore = 1">No indicators for collapsible deposits identified. No special actions required to avoid problems due to collapsible deposits.\
          </xsl:when>\
          <xsl:when test="$maxscore = 2">No indicators for collapsible deposits identified. No special actions required to avoid problems due to collapsible deposits.\
          </xsl:when>\
          <xsl:when test="$maxscore = 3">No indicators for collapsible deposits identified. No special actions required to avoid problems due to collapsible deposits. \
          </xsl:when>\
          <xsl:when test="$maxscore = 4">Significant potential for collapsible deposit problems where changes occur to loading or groundwater conditions. Seek professional advice for any proposed use of the ground or if any construction is planned.\
          </xsl:when>\
          <xsl:when test="$maxscore = 5">No indicators for collapsible deposits identified. No special actions required to avoid problems due to collapsible deposits.\
          </xsl:when>\
          <xsl:when test="$maxscore = 6">No indicators for collapsible deposits identified. No special actions required to avoid problems due to collapsible deposits.\
          </xsl:when>\
          <xsl:otherwise>No indicators for collapsible deposits identified. No special actions required to avoid problems due to collapsible deposits.</xsl:otherwise>\
        </xsl:choose>
        
Compressibles_Risk_Max=\
<xsl:variable name="maxscore" select="exmath:max(//layer/feature/attribute/value[contains(../../../name,'BGSSubsidence_Compressible_') and ../../distance &lt; 51 and ../name='RANK'])"/>\
        <xsl:choose>\
          <xsl:when test="$maxscore = 0">No indicators for compressible deposits identified. No special actions required to avoid problems due to compressible deposits.\
          </xsl:when>\
          <xsl:when test="$maxscore = 1">No indicators for compressible deposits identified. No special actions required to avoid problems due to compressible deposits.\
          </xsl:when>\
          <xsl:when test="$maxscore = 2">Very low potential for compressible deposits to be present. No special actions required to avoid problems due to compressible deposits.\
          </xsl:when>\
          <xsl:when test="$maxscore = 3">Low potential of compressibility problems. Seek professional advice if major changes to land use or any construction is planned. \
          </xsl:when>\
          <xsl:when test="$maxscore = 4">Significant potential for compressibility problems; seek professional advice if any changes to land use or any construction is planned.\
          </xsl:when>\
          <xsl:when test="$maxscore = 5">Very significant potential for compressibility problems. Seek professional advice for any proposed use of the land and if any construction is planned.\
          </xsl:when>\
          <xsl:when test="$maxscore = 6">Very significant potential for compressibility problems. Seek professional advice for any proposed use of the land and if any construction is planned.\
          </xsl:when>\
          <xsl:otherwise>No indicators for compressible deposits identified. No special actions required to avoid problems due to compressible deposits.</xsl:otherwise>\
        </xsl:choose>
        
        
Dissolution_Risk_Max=\
<xsl:variable name="maxscore" select="exmath:max(//layer/feature/attribute/value[contains(../../../name,'BGSSubsidence_Dissolution_') and ../../distance &lt; 51 and ../name='RANK'])"/>\
        <xsl:choose>\
          <xsl:when test="$maxscore = 0">Soluble rocks are not present in the search area; No special actions required to avoid problems due to soluble rocks.\
          </xsl:when>\
          <xsl:when test="$maxscore = 1">Soluble rocks are present, but unlikely to cause problems except under exceptional conditions. No special actions required to avoid problems due to soluble rocks.\
          </xsl:when>\
          <xsl:when test="$maxscore = 2">Significant soluble rocks are present, but with few dissolution features and no recorded subsidence. Problems unlikely except with considerable surface or subsurface water flow. No special actions required to avoid problems due to soluble rocks. \
          </xsl:when>\
          <xsl:when test="$maxscore = 3">Significant soluble rocks are present, with some dissolution features but no, or very little, recorded subsidence. Low possibility of subsidence  occurring naturally, but may be possible in adverse conditions such as high surface or subsurface water flow. Seek professional advice if major changes to land use or any construction is planned.\
          </xsl:when>\
          <xsl:when test="$maxscore = 4">Very significant soluble rocks are present, with numerous dissolution features and/or some recorded subsidence with a moderate possibility of local natural subsidence due to high surface or subsurface water flow. Seek professional advice if any changes to land use or any construction is planned.\
          </xsl:when>\
          <xsl:when test="$maxscore = 5">Very significant soluble rocks are present, and there are numerous dissolution features and/or considerable recorded subsidence, with a high possibility of localised subsidence occurring naturally or in adverse conditions such as high surface or subsurface water flow. Seek professional advice for any planned use of the land and if any construction is planned.\
          </xsl:when>\
          <xsl:when test="$maxscore = 6">Very significant soluble rocks are present, and there are numerous dissolution features and/or considerable recorded subsidence, with a high possibility of localised subsidence occurring naturally or in adverse conditions such as high surface or subsurface water flow. Seek professional advice for any planned use of the land and if any construction is planned.\
          </xsl:when>\
          <xsl:otherwise>Soluble rocks are not present in the search area; No special actions required to avoid problems due to soluble rocks. </xsl:otherwise>\
        </xsl:choose>
        
Sand_Risk_Max=\
<xsl:variable name="maxscore" select="exmath:max(//layer/feature/attribute/value[contains(../../../name,'BGSSubsidence_RunningSands_') and ../../distance &lt; 51 and ../name='RANK'])"/>\
        <xsl:choose>\
          <xsl:when test="$maxscore = 0">No indicators for running sand are identified. No special actions required to avoid problems due to running sand.\
          </xsl:when>\
          <xsl:when test="$maxscore = 1">No indicators for running sand are identified. No special actions required to avoid problems due to running sand.\
          </xsl:when>\
          <xsl:when test="$maxscore = 2">Very low potential for running sand problems if water table rises or if sandy strata are exposed to water. No special actions required to avoid problems due to running sand.\
          </xsl:when>\
          <xsl:when test="$maxscore = 3">Possibility of running sand problems after major changes in ground conditions; seek professional advice if major changes to land use or any construction is planned.\
          </xsl:when>\
          <xsl:when test="$maxscore = 4">Significant potential for running sand problems with relatively small changes in ground conditions; seek professional advice if any changes to land use or any construction is planned.\
          </xsl:when>\
          <xsl:when test="$maxscore = 5">Very significant potential for running sand problems; seek professional advice if any changes to land use or any construction is planned.\
          </xsl:when>\
          <xsl:when test="$maxscore = 6">Very significant potential for running sand problems; seek professional advice if any changes to land use or any construction is planned.\
          </xsl:when>\
          <xsl:otherwise>No indicators for running sand are identified. No special actions required to avoid problems due to running sand.</xsl:otherwise>\
        </xsl:choose>
        
ShrinkSwell_Risk_Max=\
<xsl:variable name="maxscore" select="exmath:max(//layer/feature/attribute/value[contains(../../../name,'BGSSubsidence_ShrinkSwell_') and ../../distance &lt; 51 and ../name='RANK'])"/>\
        <xsl:choose>\
          <xsl:when test="$maxscore = 0">Ground conditions predominantly non-plastic. No special actions required to avoid problems due to shrink-swell clays.\
          </xsl:when>\
          <xsl:when test="$maxscore = 1">Ground conditions predominantly non-plastic. No special actions required to avoid problems due to shrink-swell clays.\
          </xsl:when>\
          <xsl:when test="$maxscore = 2">Ground conditions predominantly low plasticity. No special actions required to avoid problems due to shrink-swell clays.\
          </xsl:when>\
          <xsl:when test="$maxscore = 3">Ground conditions predominantly medium plasticity. This is unlikely to lead to ground movement unless changes occur to the ground, for example, caused by planting or removal of trees; seek professional advice if major changes to land use or any construction is planned.\
          </xsl:when>\
          <xsl:when test="$maxscore = 4">Ground conditions predominantly high plasticity. This could lead to ground movement, particularly if changes occur to the ground, for example, caused by planting or removal of trees or by very wet or dry weather; seek professional advice if any changes to land use or any construction is planned.\
          </xsl:when>\
          <xsl:when test="$maxscore = 5">Ground conditions predominantly very high plasticity. This could lead to ground movement, particularly if changes occur to the ground, for example, caused by planting or removal of trees or by very wet or dry weather; seek professional advice if any changes to land use or any construction is planned.\
          </xsl:when>\
          <xsl:when test="$maxscore = 6">Ground conditions predominantly very high plasticity. This could lead to ground movement, particularly if changes occur to the ground, for example, caused by planting or removal of trees or by very wet or dry weather; seek professional advice if any changes to land use or any construction is planned.\
          </xsl:when>\
          <xsl:otherwise>Ground conditions predominantly non-plastic. No special actions required to avoid problems due to shrink-swell clays.</xsl:otherwise>\
        </xsl:choose>
        
SlopeInstability_Risk_Max=\
<xsl:variable name="maxscore" select="exmath:max(//layer/feature/attribute/value[contains(../../../name,'BGSSubsidence_SlopeInstability_') and ../../distance &lt; 51 and ../name='RANK'])"/>\
        <xsl:choose>\
          <xsl:when test="$maxscore = 0">No indicators for slope instability identified. No special actions required to avoid problems due to landslides.\
          </xsl:when>\
          <xsl:when test="$maxscore = 1">No indicators for slope instability identified. No special actions required to avoid problems due to landslides.\
          </xsl:when>\
          <xsl:when test="$maxscore = 2">Slope instability problems are unlikely to be present; No actions required to avoid problems due to landslides.\
          </xsl:when>\
          <xsl:when test="$maxscore = 3">Possibility of slope instability problems after major changes in ground conditions; seek professional advice if major changes to land use or any construction is planned.\
          </xsl:when>\
          <xsl:when test="$maxscore = 4">Significant potential for slope instability with relatively small changes in ground conditions; seek professional advice if any changes to land use or any construction is planned.\
          </xsl:when>\
          <xsl:when test="$maxscore = 5">Very significant potential for slope instability; seek professional advice for any proposed land use or if any construction is planned.\
          </xsl:when>\
          <xsl:when test="$maxscore = 6">Very significant potential for slope instability; seek professional advice for any proposed land use or if any construction is planned.\
          </xsl:when>\
          <xsl:otherwise>No indicators for slope instability identified. No special actions required to avoid problems due to landslides.</xsl:otherwise>\
        </xsl:choose>                                        
 
 
########################################################
 
Subsidence=\
		<xsl:variable name="maxscore" select="exmath:max(//layer/feature/attribute/value[contains(../../../name,'BGSSubsidence_') and ../../distance &lt; 51 and ../name='RANK'])"/>\
        <xsl:choose>\
        	<xsl:when test="$maxscore = 1">Negligible</xsl:when>\
          	<xsl:when test="$maxscore = 2">Very Low</xsl:when>\
			<xsl:when test="$maxscore = 3">Low</xsl:when>\
          	<xsl:when test="$maxscore = 4">Moderate</xsl:when>\
          	<xsl:when test="$maxscore = 5">High</xsl:when>\
		  	<xsl:otherwise>Negligible</xsl:otherwise>\
        </xsl:choose>
 
 
#Radon=<xsl:if test="count(//layer/feature[../name='Radon']) &gt; 0" > \
#      <xsl:if test="count(//layer/feature/attribute/value[../../../name='Radon' and \
#                                                                ../name='Score' and . &gt; 0]) &gt; 0"> \
#        <xsl:variable name="maxscore" select="exmath:max(//layer/feature/attribute/value[../../../name='Radon' \
#                                                                                           and ../name='Score'])"/> \
#        <xsl:value-of select="//layer/feature/attribute/value[../../../name='Radon' \
#                                                                and ../name='Estimated' and \
#                                 ($maxscore = ../../attribute/value[../name='Score'])][1] "/> \
#      </xsl:if> \
#    </xsl:if>
 
Radon=\
		<xsl:variable name="maxscore" select="exmath:max(//layer/feature/attribute/value[../../../name='Radon' and ../name='Score' and ../../distance=0])"/>\
        <xsl:choose>\
        	<xsl:when test="$maxscore = 0">No data available</xsl:when>\
            <xsl:when test="$maxscore = 1">The property is not in a Radon Affected Area, as less than 1% of properties are above the Action Level</xsl:when>\
          	<xsl:when test="$maxscore = 2">The property is in a Radon Affected Area, as between 1 and 3% of properties are above the Action Level</xsl:when>\
			<xsl:when test="$maxscore = 3">The property is in a Radon Affected Area, as between 3 and 5% of properties are above the Action Level</xsl:when>\
          	<xsl:when test="$maxscore = 4">The property is in a Radon Affected Area, as between 5 and 10% of properties are above the Action Level</xsl:when>\
          	<xsl:when test="$maxscore = 5">The property is in a Radon Affected Area, as between 10 and 30% of properties are above the Action Level</xsl:when>\
          	<xsl:when test="$maxscore = 6">The property is in a Radon Affected Area, as greater than 30% of properties are above the Action Level</xsl:when>\
		  	<xsl:otherwise>No data available</xsl:otherwise>\
        </xsl:choose>
 
 
RadonProt=<xsl:variable name="maxscore" select="exmath:max(//layer/feature/attribute/value[../../../name='Radon' and ../name='Score' and ../../distance=0])"/>\
        <xsl:choose>\
        <xsl:when test="$maxscore = 6"> \
            Full\
          </xsl:when>\
        <xsl:when test="$maxscore = 5"> \
            Full\
          </xsl:when>\
        <xsl:when test="$maxscore = 4"> \
            Basic\
          </xsl:when>\
        <xsl:when test="$maxscore = 3"> \
            Basic\
          </xsl:when>\
          <xsl:when test="$maxscore = 2"> \
            None\
          </xsl:when>\
          <xsl:when test="$maxscore = 1"> \
            None\
          </xsl:when>\
          <xsl:when test="$maxscore = 0"> \
            No Data Available\
          </xsl:when>\
        </xsl:choose>
        
RadonProtFull=<xsl:variable name="maxscore" select="exmath:max(//layer/feature/attribute/value[../../../name='Radon' and ../name='Score' and ../../distance=0])"/>\
        <xsl:choose> \
        <xsl:when test="$maxscore = 6"> \
            Full radon protective measures are necessary\
          </xsl:when>\
        <xsl:when test="$maxscore = 5"> \
            Full radon protective measures are necessary\
          </xsl:when>\
        <xsl:when test="$maxscore = 4"> \
            Basic radon protective measures are necessary\
          </xsl:when>\
        <xsl:when test="$maxscore = 3"> \
            Basic radon protective measures are necessary\
          </xsl:when>\
          <xsl:when test="$maxscore = 2"> \
            No radon protective measures are necessary\
          </xsl:when>\
          <xsl:when test="$maxscore = 1"> \
            No radon protective measures are necessary\
          </xsl:when> \
          <xsl:when test="$maxscore = 0"> \
            No Data Available\
          </xsl:when> \
        </xsl:choose>
 
#map#LocationMap2
 
#map#LocationPhoto
 
lm_pcucount250=<xsl:choose> \
      <xsl:when test="count(//layer/feature[../name='LM_History']) &gt; 0">Yes</xsl:when> \
      <xsl:otherwise>No</xsl:otherwise> \
    </xsl:choose>
 
ratvalue_LM_History=\
          <xsl:call-template name="conditional">\
            <xsl:with-param name="conditionalTest" select="count(//rating/altDescription[../layer='LM_History']) = 0"/>\
            <xsl:with-param name="overrideVariable">override</xsl:with-param>\
            <xsl:with-param name="text" select="//rating/description[../layer='LM_History']"/>\
            <xsl:with-param name="altText" select="//rating/altDescription[../layer='LM_History']"/>\
          </xsl:call-template>
 
rattext_LM_History=<xsl:choose> \
      <xsl:when test="count(//layer/feature[../name='LM_History']) &gt; 0"> \
        <xsl:call-template name="conditional">\
          <xsl:with-param name="conditionalTest" select="count(//rating/altCode[../layer='LM_History']) = 0"/>\
          <xsl:with-param name="overrideVariable">override</xsl:with-param>\
          <xsl:with-param name="text" select="//rating/code[../layer='LM_History']"/>\
          <xsl:with-param name="altText" select="//rating/altCode[../layer='LM_History']"/>\
        </xsl:call-template>\
      </xsl:when> \
      <xsl:otherwise> \
        GroundSure has searched this database and no data was found. No further action is recommended.\
      </xsl:otherwise> \
    </xsl:choose>
 
ra_GS_History_apply=<xsl:variable name="apply" select="//layer/feature/attribute/value[ \
                                ../../../name='25inchtest' and ../name='DataAvailable']"/> \
    <xsl:choose> \
      <xsl:when test="$apply = 'YES'"> </xsl:when> \
      <xsl:otherwise>#DELETE#</xsl:otherwise> \
    </xsl:choose>
 
gs_pcucount250=<xsl:choose> \
       <xsl:when test="count(//layer/feature[../name='GS_History_25']) &gt; 0">Yes</xsl:when> \
       <xsl:otherwise>No</xsl:otherwise> \
     </xsl:choose>
 
rattext_GS_History_25=<xsl:choose> \
      <xsl:when test="count(//layer/feature[../name='GS_History_25']) &gt; 0"> \
        <xsl:call-template name="conditional">\
          <xsl:with-param name="conditionalTest" select="count(//rating/altCode[../layer='GS_History_25']) = 0"/>\
          <xsl:with-param name="overrideVariable">override</xsl:with-param>\
          <xsl:with-param name="text" select="//rating/code[../layer='GS_History_25']"/>\
          <xsl:with-param name="altText" select="//rating/altCode[../layer='GS_History_25']"/>\
        </xsl:call-template>\
      </xsl:when> \
      <xsl:otherwise> \
        GroundSure has searched this database and no data was found. No further action is recommended.\
      </xsl:otherwise> \
    </xsl:choose>
 
lm_ifcount250=<xsl:choose> \
      <xsl:when test="count(//layer/feature[../name='LM_Infilled']) &gt; 0">Yes</xsl:when> \
      <xsl:otherwise>No</xsl:otherwise> \
    </xsl:choose>
 
rattext_LM_Infilled=<xsl:choose>\
      <xsl:when test="count(//layer/feature[../name='LM_Infilled']) &gt; 0"> \
          <xsl:call-template name="conditional">\
            <xsl:with-param name="conditionalTest" select="count(//rating/altCode[../layer='LM_Infilled']) = 0"/>\
            <xsl:with-param name="overrideVariable">override</xsl:with-param>\
            <xsl:with-param name="text" select="//rating/code[../layer='LM_Infilled']"/>\
            <xsl:with-param name="altText" select="//rating/altCode[../layer='LM_Infilled']"/>\
          </xsl:call-template>\
      </xsl:when> \
      <xsl:otherwise> \
        GroundSure has searched this database and no data was found. No further action is recommended.\
      </xsl:otherwise> \
    </xsl:choose>
 
fillscount500=<xsl:variable name="count" select="count(//layer/feature[../name='Technos Operational Landfills']) + \
                                                 count(//layer/feature[../name='Technos Closed Landfills']) + \
                                                 count(//layer/feature[../name='BGS Landfills']) + \
                                                 count(//layer/feature[../name='EA Closed Landfills']) + \
                                                 count(//layer/feature[../name='EA Landfills'])"/> \
    <xsl:choose> \
      <xsl:when test="$count &gt; 0">Yes</xsl:when> \
      <xsl:otherwise>No</xsl:otherwise> \
    </xsl:choose>
 
ratvalue_LM_Infilled=\
          <xsl:call-template name="conditional">\
            <xsl:with-param name="conditionalTest" select="count(//rating/altDescription[../layer='LM_Infilled']) = 0"/>\
            <xsl:with-param name="overrideVariable">override</xsl:with-param>\
            <xsl:with-param name="text" select="//rating/description[../layer='LM_Infilled']"/>\
            <xsl:with-param name="altText" select="//rating/altDescription[../layer='LM_Infilled']"/>\
          </xsl:call-template>
 
ratvalue_GS_History_25=\
          <xsl:call-template name="conditional">\
            <xsl:with-param name="conditionalTest" select="count(//rating/altDescription[../layer='GS_History_25']) = 0"/>\
            <xsl:with-param name="overrideVariable">override</xsl:with-param>\
            <xsl:with-param name="text" select="//rating/description[../layer='GS_History_25']"/>\
            <xsl:with-param name="altText" select="//rating/altDescription[../layer='GS_History_25']"/>\
          </xsl:call-template>
 
ratvalue_Comah=\
          <xsl:call-template name="conditional">\
            <xsl:with-param name="conditionalTest" select="count(//rating/altDescription[../layer='COMAH Sites']) = 0"/>\
            <xsl:with-param name="overrideVariable">override</xsl:with-param>\
            <xsl:with-param name="text" select="//rating/description[../layer='COMAH Sites']"/>\
            <xsl:with-param name="altText" select="//rating/altDescription[../layer='COMAH Sites']"/>\
          </xsl:call-template>
 
ratvalue_Fills=<xsl:variable name="count" select="count(//layer/feature[../name='Technos Operational Landfills']) + \
                                                  count(//layer/feature[../name='Technos Closed Landfills']) + \
                                                  count(//layer/feature[../name='BGS Landfills']) + \
                                                  count(//layer/feature[../name='EA Closed Landfills']) + \
                                                  count(//layer/feature[../name='EA Landfills'])"/> \
    <xsl:choose> \
      <xsl:when test="$count &gt; 0"> \
        <xsl:choose> \
          <xsl:when test="//rating/value[../layer='Technos Operational Landfills'] + \
                          //rating/value[../layer='Technos Closed Landfills'] + \
                          //rating/value[../layer='BGS Landfills'] + \
                          //rating/value[../layer='EA Closed Landfills'] + \
                          //rating/value[../layer='EA Landfills'] &gt; 0"> \
            <xsl:variable name="rating" select="exmath:max(//rating/value[../layer='Technos Operational Landfills'] | \
                                                           //rating/value[../layer='Technos Closed Landfills'] | \
                                                           //rating/value[../layer='BGS Landfills'] | \
                                                           //rating/value[../layer='EA Closed Landfills'] | \
                                                           //rating/value[../layer='EA Landfills'])"/> \
            <xsl:call-template name="conditional">\
              <xsl:with-param name="conditionalTest" select="count(//rating/altDescription[(../layer='Technos Operational Landfills' or \
                                                  ../layer='Technos Closed Landfills'or \
                                                  ../layer='BGS Landfills' or \
                                                  ../layer='EA Closed Landfills' or \
                                                  ../layer='EA Landfills') and (../value = $rating)][1]) = 0"/>\
              <xsl:with-param name="overrideVariable">override</xsl:with-param>\
              <xsl:with-param name="text" select="//rating/description[(../layer='Technos Operational Landfills' or \
                                                  ../layer='Technos Closed Landfills'or \
                                                  ../layer='BGS Landfills' or \
                                                  ../layer='EA Closed Landfills' or \
                                                  ../layer='EA Landfills') and (../value = $rating)][1]"/>\
              <xsl:with-param name="altText" select="//rating/altDescription[(../layer='Technos Operational Landfills' or \
                                                  ../layer='Technos Closed Landfills'or \
                                                  ../layer='BGS Landfills' or \
                                                  ../layer='EA Closed Landfills' or \
                                                  ../layer='EA Landfills') and (../value = $rating)][1]"/>\
            </xsl:call-template>\
          </xsl:when> \
          <xsl:otherwise> \
            <xsl:value-of select ="//rating/description[(../layer='Technos Operational Landfills' or \
                                                         ../layer='Technos Closed Landfills' or \
                                                         ../layer='BGS Landfills' or \
                                                         ../layer='EA Closed Landfills' or \
                                                         ../layer='EA Landfills')][1]"/> \
          </xsl:otherwise> \
        </xsl:choose> \
      </xsl:when> \
      <xsl:otherwise> \
        <xsl:value-of select ="//rating/description[(../layer='Technos Operational Landfills' or \
                                                     ../layer='Technos Closed Landfills' or \
                                                     ../layer='BGS Landfills' or \
                                                     ../layer='EA Closed Landfills' or \
                                                     ../layer='EA Landfills')][1]"/> \
      </xsl:otherwise> \
    </xsl:choose>
 
#The conditionalTest parameter seems redundent here, because the surrounding code has already esablished that
#we are in a fail situation. I have left it in for now but may do new template that doesn't have the test parameter 
 
rattext_Fills=<xsl:variable name="count" select="count(//layer/feature[../name='Technos Operational Landfills']) + \
                                                 count(//layer/feature[../name='Technos Closed Landfills']) + \
                                                 count(//layer/feature[../name='BGS Landfills']) + \
                                                 count(//layer/feature[../name='EA Closed Landfills']) + \
                                                 count(//layer/feature[../name='EA Landfills'])"/> \
    <xsl:choose> \
      <xsl:when test="$count &gt; 0"> \
        <xsl:choose> \
          <xsl:when test="//rating/value[../layer='Technos Operational Landfills'] + \
                          //rating/value[../layer='Technos Closed Landfills'] + \
                          //rating/value[../layer='BGS Landfills'] + \
                          //rating/value[../layer='EA Closed Landfills'] + \
                          //rating/value[../layer='EA Landfills'] &gt; 0"> \
            <xsl:variable name="rating" select="exmath:max(//rating/value[../layer='Technos Operational Landfills'] | \
                                                           //rating/value[../layer='Technos Closed Landfills'] | \
                                                           //rating/value[../layer='BGS Landfills'] | \
                                                           //rating/value[../layer='EA Closed Landfills'] | \
                                                           //rating/value[../layer='EA Landfills'])"/> \
            <xsl:call-template name="conditional">\
              <xsl:with-param name="conditionalTest" select="count(//rating/altCode[(../layer='Technos Operational Landfills' or \
                                                  ../layer='Technos Closed Landfills'or \
                                                  ../layer='BGS Landfills' or \
                                                  ../layer='EA Closed Landfills' or \
                                                  ../layer='EA Landfills') and (../value = $rating)][1]) = 0"/>\
              <xsl:with-param name="overrideVariable">override</xsl:with-param>\
              <xsl:with-param name="text" select="//rating/code[(../layer='Technos Operational Landfills' or \
                                                  ../layer='Technos Closed Landfills'or \
                                                  ../layer='BGS Landfills' or \
                                                  ../layer='EA Closed Landfills' or \
                                                  ../layer='EA Landfills') and (../value = $rating)][1]"/>\
              <xsl:with-param name="altText" select="//rating/altCode[(../layer='Technos Operational Landfills' or \
                                                  ../layer='Technos Closed Landfills'or \
                                                  ../layer='BGS Landfills' or \
                                                  ../layer='EA Closed Landfills' or \
                                                  ../layer='EA Landfills') and (../value = $rating)][1]"/>\
            </xsl:call-template>\
          </xsl:when> \
          <xsl:otherwise> \
            <xsl:value-of select ="//rating/code[(../layer='Technos Operational Landfills' or \
                                                  ../layer='Technos Closed Landfills' or \
                                                  ../layer='BGS Landfills' or \
                                                  ../layer='EA Closed Landfills' or \
                                                  ../layer='EA Landfills')][1]"/> \
          </xsl:otherwise> \
        </xsl:choose> \
      </xsl:when> \
      <xsl:otherwise> \
        GroundSure has searched this database and no data was found. No further action is recommended. \
      </xsl:otherwise> \
    </xsl:choose>
 
wastecount250=<xsl:variable name="count" select="count(//layer/feature[../name='Technos Operational Waste Sites']) + \
                                                 count(//layer/feature[../name='Technos Closed Waste Sites'])"/> \
    <xsl:choose> \
      <xsl:when test="$count &gt; 0">Yes</xsl:when> \
      <xsl:otherwise>No</xsl:otherwise> \
    </xsl:choose>
 
ratvalue_Waste=<xsl:variable name="count" select="count(//layer/feature[../name='Technos Operational Waste Sites']) + \
                                                  count(//layer/feature[../name='Technos Closed Waste Sites'])"/> \
    <xsl:choose> \
      <xsl:when test="$count &gt; 0"> \
        <xsl:choose> \
          <xsl:when test="//rating/value[../layer='Technos Operational Waste Sites'] + \
                          //rating/value[../layer='Technos Closed Waste Sites'] &gt; 0"> \
            <xsl:variable name="rating" select="exmath:max(//rating/value[../layer='Technos Operational Waste Sites'] | \
                                                           //rating/value[../layer='Technos Closed Waste Sites'])"/> \
            <xsl:call-template name="conditional">\
              <xsl:with-param name="conditionalTest" select="count(//rating/altDescription[(../layer='Technos Operational Waste Sites' or \
                                                         ../layer='Technos Closed Waste Sites') and (../value = $rating)][1]) = 0"/>\
              <xsl:with-param name="overrideVariable">override</xsl:with-param>\
              <xsl:with-param name="text" select="//rating/description[(../layer='Technos Operational Waste Sites' or \
                                                         ../layer='Technos Closed Waste Sites') and (../value = $rating)][1]"/>\
              <xsl:with-param name="altText" select="//rating/altDescription[(../layer='Technos Operational Waste Sites' or \
                                                         ../layer='Technos Closed Waste Sites') and (../value = $rating)][1]"/>\
            </xsl:call-template>\
          </xsl:when> \
          <xsl:otherwise> \
            <xsl:value-of select ="//rating/description[(../layer='Technos Operational Waste Sites' or \
                                                         ../layer='Technos Closed Waste Sites')][1]"/> \
          </xsl:otherwise> \
        </xsl:choose> \
      </xsl:when> \
      <xsl:otherwise><xsl:value-of select ="//rating/description[(../layer='Technos Operational Waste Sites' or \
                                                                  ../layer='Technos Closed Waste Sites')][1]"/>\
      </xsl:otherwise> \
    </xsl:choose>
 
ratvalue_Kellys=\
            <xsl:call-template name="conditional">\
              <xsl:with-param name="conditionalTest" select="count(//rating/altDescription[../layer='Kellys']) = 0"/>\
              <xsl:with-param name="overrideVariable">override</xsl:with-param>\
              <xsl:with-param name="text" select="//rating/description[../layer='Kellys']"/>\
              <xsl:with-param name="altText" select="//rating/altDescription[../layer='Kellys']"/>\
            </xsl:call-template>
            
ratvalue_Pipe=\
            <xsl:call-template name="conditional">\
              <xsl:with-param name="conditionalTest" select="count(//rating/altDescription[../layer='UndergroundPipelines']) = 0"/>\
              <xsl:with-param name="overrideVariable">override</xsl:with-param>\
              <xsl:with-param name="text" select="//rating/description[../layer='UndergroundPipelines']"/>\
              <xsl:with-param name="altText" select="//rating/altDescription[../layer='UndergroundPipelines']"/>\
            </xsl:call-template>            
 
ratvalue_laapcENF=\
            <xsl:call-template name="conditional">\
              <xsl:with-param name="conditionalTest" select="count(//rating/altDescription[../layer='LAAPC_ENF']) = 0"/>\
              <xsl:with-param name="overrideVariable">override</xsl:with-param>\
              <xsl:with-param name="text" select="//rating/description[../layer='LAAPC_ENF']"/>\
              <xsl:with-param name="altText" select="//rating/altDescription[../layer='LAAPC_ENF']"/>\
            </xsl:call-template> 
            
ratvalue_Catalist=\
            <xsl:call-template name="conditional">\
              <xsl:with-param name="conditionalTest" select="count(//rating/altDescription[../layer='Catalist']) = 0"/>\
              <xsl:with-param name="overrideVariable">override</xsl:with-param>\
              <xsl:with-param name="text" select="//rating/description[../layer='Catalist']"/>\
              <xsl:with-param name="altText" select="//rating/altDescription[../layer='Catalist']"/>\
            </xsl:call-template>
 
ratvalue_IPC=\
            <xsl:call-template name="conditional">\
              <xsl:with-param name="conditionalTest" select="count(//rating/altDescription[../layer='IPC']) = 0"/>\
              <xsl:with-param name="overrideVariable">override</xsl:with-param>\
              <xsl:with-param name="text" select="//rating/description[../layer='IPC']"/>\
              <xsl:with-param name="altText" select="//rating/altDescription[../layer='IPC']"/>\
            </xsl:call-template>
 
ratvalue_Lapc=\
            <xsl:call-template name="conditional">\
              <xsl:with-param name="conditionalTest" select="count(//rating/altDescription[../layer='LAAPC']) = 0"/>\
              <xsl:with-param name="overrideVariable">override</xsl:with-param>\
              <xsl:with-param name="text" select="//rating/description[../layer='LAAPC']"/>\
              <xsl:with-param name="altText" select="//rating/altDescription[../layer='LAAPC']"/>\
            </xsl:call-template>
 
ratvalue_Ras=<xsl:variable name="count" select="count(//layer/feature[../name='RAS12']) + \
                                                count(//layer/feature[../name='RAS34'])"/> \
    <xsl:choose> \
      <xsl:when test="$count &gt; 0"> \
        <xsl:choose> \
          <xsl:when test="//rating/value[../layer='RAS12'] + \
                          //rating/value[../layer='RAS34'] &gt; 0"> \
            <xsl:variable name="rating" select="exmath:max(//rating/value[../layer='RAS12'] | \
                                                           //rating/value[../layer='RAS34'])"/> \
            <xsl:call-template name="conditional">\
              <xsl:with-param name="conditionalTest" select="count(//rating/altDescription[(../layer='RAS12' or \
                                                         ../layer='RAS34') and (../value = $rating)][1]) = 0"/>\
              <xsl:with-param name="overrideVariable">override</xsl:with-param>\
              <xsl:with-param name="text" select="//rating/description[(../layer='RAS12' or \
                                                         ../layer='RAS34') and (../value = $rating)][1]"/>\
              <xsl:with-param name="altText" select="//rating/altDescription[(../layer='RAS12' or \
                                                         ../layer='RAS34') and (../value = $rating)][1]"/>\
            </xsl:call-template>\
          </xsl:when> \
          <xsl:otherwise> \
            <xsl:value-of select ="//rating/description[(../layer='RAS12' or \
                                                         ../layer='RAS34') ][1]"/> \
          </xsl:otherwise> \
        </xsl:choose> \
      </xsl:when> \
      <xsl:otherwise> \
            <xsl:value-of select ="//rating/description[(../layer='RAS12' or \
                                                         ../layer='RAS34') ][1]"/> \
      </xsl:otherwise>\
    </xsl:choose>
 
rattext_Waste=<xsl:variable name="count" select="count(//layer/feature[../name='Technos Operational Waste Sites']) + \
                                                 count(//layer/feature[../name='Technos Closed Waste Sites'])"/> \
    <xsl:choose> \
      <xsl:when test="$count &gt; 0"> \
        <xsl:choose> \
          <xsl:when test="//rating/value[../layer='Technos Operational Waste Sites'] + \
                          //rating/value[../layer='Technos Closed Waste Sites'] &gt; 0"> \
            <xsl:variable name="rating" select="exmath:max(//rating/value[../layer='Technos Operational Waste Sites'] | \
                                                           //rating/value[../layer='Technos Closed Waste Sites'])"/> \
            <xsl:call-template name="conditional">\
              <xsl:with-param name="conditionalTest" select="count(//rating/altCode[(../layer='Technos Operational Waste Sites' or \
                                                  ../layer='Technos Closed Waste Sites') and (../value = $rating)][1]) = 0"/>\
              <xsl:with-param name="overrideVariable">override</xsl:with-param>\
              <xsl:with-param name="text" select="//rating/code[(../layer='Technos Operational Waste Sites' or \
                                                  ../layer='Technos Closed Waste Sites') and (../value = $rating)][1]"/>\
              <xsl:with-param name="altText" select="//rating/altCode[(../layer='Technos Operational Waste Sites' or \
                                                  ../layer='Technos Closed Waste Sites') and (../value = $rating)][1]"/>\
            </xsl:call-template>\
          </xsl:when> \
          <xsl:otherwise> \
            <xsl:value-of select ="//rating/code[(../layer='Technos Operational Waste Sites' or \
                                                  ../layer='Technos Closed Waste Sites') ][1]"/> \
          </xsl:otherwise> \
        </xsl:choose> \
      </xsl:when> \
      <xsl:otherwise> \
        GroundSure has searched this database and no data was found. No further action is recommended.\
      </xsl:otherwise> \
    </xsl:choose>
 
Pipe_Count250=<xsl:choose> \
      <xsl:when test="count(//layer/feature[../name='UndergroundPipelines']) &gt; 0">Yes</xsl:when> \
      <xsl:otherwise>No</xsl:otherwise> \
    </xsl:choose>
 
rattext_Pipe=<xsl:choose> \
      <xsl:when test="count(//layer/feature[../name='UndergroundPipelines']) &gt; 0"> \
            <xsl:call-template name="conditional">\
              <xsl:with-param name="conditionalTest" select="count(//rating/altCode[../layer='UndergroundPipelines']) = 0"/>\
              <xsl:with-param name="overrideVariable">override</xsl:with-param>\
              <xsl:with-param name="text" select="//rating/code[../layer='UndergroundPipelines']"/>\
              <xsl:with-param name="altText" select="//rating/altCode[../layer='UndergroundPipelines']"/>\
            </xsl:call-template>\
      </xsl:when> \
      <xsl:otherwise> \
        GroundSure has searched this database and no data was found. No further action is recommended.\
      </xsl:otherwise> \
    </xsl:choose>
    
laapcENF_Count250=<xsl:choose> \
      <xsl:when test="count(//layer/feature[../name='LAAPC_ENF']) &gt; 0">Yes</xsl:when> \
      <xsl:otherwise>No</xsl:otherwise> \
    </xsl:choose>
 
rattext_laapcENF=<xsl:choose> \
      <xsl:when test="count(//layer/feature[../name='LAAPC_ENF']) &gt; 0"> \
            <xsl:call-template name="conditional">\
              <xsl:with-param name="conditionalTest" select="count(//rating/altCode[../layer='LAAPC_ENF']) = 0"/>\
              <xsl:with-param name="overrideVariable">override</xsl:with-param>\
              <xsl:with-param name="text" select="//rating/code[../layer='LAAPC_ENF']"/>\
              <xsl:with-param name="altText" select="//rating/altCode[../layer='LAAPC_ENF']"/>\
            </xsl:call-template>\
      </xsl:when> \
      <xsl:otherwise> \
        GroundSure has searched this database and no data was found. No further action is recommended.\
      </xsl:otherwise> \
    </xsl:choose>
    
 
kellyscount250=<xsl:choose> \
      <xsl:when test="count(//layer/feature[../name='Kellys']) &gt; 0">Yes</xsl:when> \
      <xsl:otherwise>No</xsl:otherwise> \
    </xsl:choose>
 
rattext_Kellys=<xsl:choose> \
      <xsl:when test="count(//layer/feature[../name='Kellys']) &gt; 0"> \
            <xsl:call-template name="conditional">\
              <xsl:with-param name="conditionalTest" select="count(//rating/altCode[../layer='Kellys']) = 0"/>\
              <xsl:with-param name="overrideVariable">override</xsl:with-param>\
              <xsl:with-param name="text" select="//rating/code[../layer='Kellys']"/>\
              <xsl:with-param name="altText" select="//rating/altCode[../layer='Kellys']"/>\
            </xsl:call-template>\
      </xsl:when> \
      <xsl:otherwise> \
        GroundSure has searched this database and no data was found. No further action is recommended.\
      </xsl:otherwise> \
    </xsl:choose>    
    
catalistcount250=<xsl:choose> \
      <xsl:when test="count(//layer/feature[../name='Catalist']) &gt; 0">Yes</xsl:when> \
	<xsl:otherwise>No</xsl:otherwise> \
    </xsl:choose>
 
rattext_Catalist=<xsl:choose> \
      <xsl:when test="count(//layer/feature[../name='Catalist']) &gt; 0"> \
            <xsl:call-template name="conditional">\
              <xsl:with-param name="conditionalTest" select="count(//rating/altCode[../layer='Catalist']) = 0"/>\
              <xsl:with-param name="overrideVariable">override</xsl:with-param>\
              <xsl:with-param name="text" select="//rating/code[../layer='Catalist']"/>\
              <xsl:with-param name="altText" select="//rating/altCode[../layer='Catalist']"/>\
            </xsl:call-template>\
      </xsl:when> \
      <xsl:otherwise>\
        GroundSure has searched this database and no data was found. No further action is recommended.\
      </xsl:otherwise> \
    </xsl:choose>
 
ipccount500=<xsl:choose> \
      <xsl:when test="count(//layer/feature[../name='IPC']) &gt; 0">Yes</xsl:when> \
	<xsl:otherwise>No</xsl:otherwise> \
    </xsl:choose>
 
rattext_IPC=<xsl:choose> \
      <xsl:when test="count(//layer/feature[../name='IPC']) &gt; 0"> \
            <xsl:call-template name="conditional">\
              <xsl:with-param name="conditionalTest" select="count(//rating/altCode[../layer='IPC']) = 0"/>\
              <xsl:with-param name="overrideVariable">override</xsl:with-param>\
              <xsl:with-param name="text" select="//rating/code[../layer='IPC']"/>\
              <xsl:with-param name="altText" select="//rating/altCode[../layer='IPC']"/>\
            </xsl:call-template>\
      </xsl:when> \
      <xsl:otherwise> \
        GroundSure has searched this database and no data was found. No further action is recommended.\
      </xsl:otherwise> \
    </xsl:choose>
 
lapccount250=<xsl:choose> \
      <xsl:when test="count(//layer/feature[../name='LAAPC']) &gt; 0">Yes</xsl:when> \
      <xsl:otherwise>No</xsl:otherwise> \
    </xsl:choose>
 
rattext_Lapc=<xsl:choose> \
      <xsl:when test="count(//layer/feature[../name='LAAPC']) &gt; 0"> \
            <xsl:call-template name="conditional">\
              <xsl:with-param name="conditionalTest" select="count(//rating/altCode[../layer='LAAPC']) = 0"/>\
              <xsl:with-param name="overrideVariable">override</xsl:with-param>\
              <xsl:with-param name="text" select="//rating/code[../layer='LAAPC']"/>\
              <xsl:with-param name="altText" select="//rating/altCode[../layer='LAAPC']"/>\
            </xsl:call-template>\
      </xsl:when> \
      <xsl:otherwise> \
        GroundSure has searched this database and no data was found. No further action is recommended.\
      </xsl:otherwise> \
    </xsl:choose>
 
rascount500=<xsl:variable name="count" select="count(//layer/feature[../name='RAS12']) + \
                                               count(//layer/feature[../name='RAS34'])"/> \
    <xsl:choose> \
      <xsl:when test="$count &gt; 0">Yes</xsl:when> \
      <xsl:otherwise>No</xsl:otherwise> \
    </xsl:choose>
 
rattext_Ras=<xsl:variable name="count" select="count(//layer/feature[../name='RAS12']) + \
                                               count(//layer/feature[../name='RAS34'])"/> \
    <xsl:choose> \
      <xsl:when test="$count &gt; 0"> \
        <xsl:choose> \
          <xsl:when test="//rating/value[../layer='RAS12'] + \
                          //rating/value[../layer='RAS34'] &gt; 0"> \
            <xsl:variable name="rating" select="exmath:max(//rating/value[../layer='RAS12'] | \
                                                           //rating/value[../layer='RAS34'])"/> \
            <xsl:call-template name="conditional">\
              <xsl:with-param name="conditionalTest" select="count(//rating/altCode[(../layer='RAS12' or \
                                                  ../layer='RAS34' ) and (../value = $rating)][1]) = 0"/>\
              <xsl:with-param name="overrideVariable">override</xsl:with-param>\
              <xsl:with-param name="text" select="//rating/code[(../layer='RAS12' or \
                                                  ../layer='RAS34' ) and (../value = $rating)][1]"/>\
              <xsl:with-param name="altText" select="//rating/altCode[(../layer='RAS12' or \
                                                  ../layer='RAS34' ) and (../value = $rating)][1]"/>\
            </xsl:call-template>\
          </xsl:when> \
          <xsl:otherwise> \
            <xsl:value-of select ="//rating/code[(../layer='RAS12' or \
                                                  ../layer='RAS34') ][1]"/> \
          </xsl:otherwise> \
        </xsl:choose> \
      </xsl:when> \
      <xsl:otherwise> \
        GroundSure has searched this database and no data was found. No further action is recommended.\
      </xsl:otherwise> \
    </xsl:choose>
 
dischargecount250=<xsl:variable name="count" select="count(//layer/feature[../name='Discharge Consents']) + \
                                                     count(//layer/feature[../name='Redlist Discharge Consents']) + \
                                                     count(//layer/feature[../name='Water Discharge Consents'])"/> \
    <xsl:choose> \
      <xsl:when test="$count &gt; 0">Yes</xsl:when> \
      <xsl:otherwise>No</xsl:otherwise> \
    </xsl:choose>
 
ratvalue_Discharges=<xsl:variable name="count" select="count(//layer/feature[../name='Discharge Consents']) + \
                                                       count(//layer/feature[../name='Redlist Discharge Consents']) + \
                                                       count(//layer/feature[../name='Water Discharge Consents'])"/> \
    <xsl:choose> \
      <xsl:when test="$count &gt; 0"> \
        <xsl:choose> \
          <xsl:when test="//rating/value[../layer='Discharge Consents'] + \
                          //rating/value[../layer='Redlist Discharge Consents'] + \
                          //rating/value[../layer='Water Discharge Consents'] &gt; 0"> \
            <xsl:variable name="rating" select="exmath:max(//rating/value[../layer='Discharge Consents'] | \
                                                           //rating/value[../layer='Redlist Discharge Consents'] | \
                                                           //rating/value[../layer='Water Discharge Consents'])"/> \
            <xsl:call-template name="conditional">\
              <xsl:with-param name="conditionalTest" select="count(//rating/altDescription[(../layer='Discharge Consents' or \
                                                         ../layer='Redlist Discharge Consents' or \
                                                         ../layer='Water Discharge Consents' ) and \
                                                                      (../value = $rating)][1]) = 0"/>\
              <xsl:with-param name="overrideVariable">override</xsl:with-param>\
              <xsl:with-param name="text" select="//rating/description[(../layer='Discharge Consents' or \
                                                         ../layer='Redlist Discharge Consents' or \
                                                         ../layer='Water Discharge Consents' ) and \
                                                                      (../value = $rating)][1]"/>\
              <xsl:with-param name="altText" select="//rating/altDescription[(../layer='Discharge Consents' or \
                                                         ../layer='Redlist Discharge Consents' or \
                                                         ../layer='Water Discharge Consents' ) and \
                                                                      (../value = $rating)][1]"/>\
            </xsl:call-template>\
          </xsl:when> \
          <xsl:otherwise> \
            <xsl:value-of select ="//rating/description[(../layer='Discharge Consents' or \
                                                         ../layer='Redlist Discharge Consents' or \
                                                         ../layer='Water Discharge Consents')][1]"/> \
          </xsl:otherwise> \
        </xsl:choose> \
      </xsl:when> \
      <xsl:otherwise>\
        <xsl:value-of select ="//rating/description[(../layer='Discharge Consents' or \
                                                     ../layer='Redlist Discharge Consents' or \
                                                     ../layer='Water Discharge Consents')][1]"/> \
      </xsl:otherwise> \
    </xsl:choose>
 
rattext_Discharges=<xsl:variable name="count" select="count(//layer/feature[../name='Discharge Consents']) + \
                                                      count(//layer/feature[../name='Redlist Discharge Consents']) + \
                                                      count(//layer/feature[../name='Water Discharge Consents'])"/> \
    <xsl:choose> \
      <xsl:when test="$count &gt; 0"> \
        <xsl:choose> \
          <xsl:when test="//rating/value[../layer='Discharge Consents'] + \
                          //rating/value[../layer='Redlist Discharge Consents'] + \
                          //rating/value[../layer='Water Discharge Consents'] &gt; 0"> \
          <xsl:variable name="rating" select="exmath:max(//rating/value[../layer='Discharge Consents'] | \
                                                         //rating/value[../layer='Redlist Discharge Consents'] | \
                                                         //rating/value[../layer='Water Discharge Consents'])" /> \
            <xsl:call-template name="conditional">\
              <xsl:with-param name="conditionalTest" select="count(//rating/altCode[(../layer='Discharge Consents' or \
                                                ../layer='Redlist Discharge Consents' or \
                                                ../layer='Water Discharge Consents' ) and (../value = $rating)][1]) = 0"/>\
              <xsl:with-param name="overrideVariable">override</xsl:with-param>\
              <xsl:with-param name="text" select="//rating/code[(../layer='Discharge Consents' or \
                                                ../layer='Redlist Discharge Consents' or \
                                                ../layer='Water Discharge Consents' ) and (../value = $rating)][1]"/>\
              <xsl:with-param name="altText" select="//rating/altCode[(../layer='Discharge Consents' or \
                                                ../layer='Redlist Discharge Consents' or \
                                                ../layer='Water Discharge Consents' ) and (../value = $rating)][1]"/>\
            </xsl:call-template>\
          </xsl:when> \
          <xsl:otherwise> \
            <xsl:value-of select ="//rating/code[(../layer='Discharge Consents' or \
                                                  ../layer='Redlist Discharge Consents' or \
                                                  ../layer='Water Discharge Consents')][1]" /> \
          </xsl:otherwise> \
        </xsl:choose> \
      </xsl:when> \
      <xsl:otherwise> \
        GroundSure has searched this database and no data was found. No further action is recommended.\
      </xsl:otherwise> \
    </xsl:choose>
 
	   
Dsicount500=<xsl:variable name="count" select="count(//layer/feature[../name='List 1 Dangerous Substances']) + \
                                               count(//layer/feature[../name='List 2 Dangerous Substances'])"/> \
    <xsl:choose> \
      <xsl:when test="$count &gt; 0">Yes</xsl:when> \
      <xsl:otherwise>No</xsl:otherwise> \
    </xsl:choose>
 
ratvalue_Dsi=<xsl:variable name="count" select="count(//layer/feature[../name='List 1 Dangerous Substances']) + \
                                                count(//layer/feature[../name='List 2 Dangerous Substances'])"/> \
    <xsl:choose> \
      <xsl:when test="$count &gt; 0" >\
        <xsl:choose> \
          <xsl:when test="//rating/value[../layer='List 1 Dangerous Substances'] + \
                          //rating/value[../layer='List 2 Dangerous Substances'] &gt; 0"> \
            <xsl:variable name="rating" select="exmath:max(//rating/value[../layer='List 1 Dangerous Substances'] | \
                                                           //rating/value[../layer='List 2 Dangerous Substances'])" /> \
\
            <xsl:call-template name="conditional">\
              <xsl:with-param name="conditionalTest" select="count(//rating/altDescription[(../layer='List 1 Dangerous Substances' or \
                                                        ../layer='List 2 Dangerous Substances') and (../value = $rating)][1]) = 0"/>\
              <xsl:with-param name="overrideVariable">override</xsl:with-param>\
              <xsl:with-param name="text" select="//rating/description[(../layer='List 1 Dangerous Substances' or \
                                                        ../layer='List 2 Dangerous Substances') and (../value = $rating)][1]"/>\
              <xsl:with-param name="altText" select="//rating/altDescription[(../layer='List 1 Dangerous Substances' or \
                                                        ../layer='List 2 Dangerous Substances') and (../value = $rating)][1]"/>\
            </xsl:call-template>\
          </xsl:when> \
          <xsl:otherwise> \
            <xsl:value-of select ="//rating/description[(../layer='List 1 Dangerous Substances' or \
                                                         ../layer='List 2 Dangerous Substances')][1]" /> \
          </xsl:otherwise> \
        </xsl:choose> \
      </xsl:when>  \
      <xsl:otherwise>\
         <xsl:value-of select ="//rating/description[(../layer='List 1 Dangerous Substances' or \
                                                      ../layer='List 2 Dangerous Substances')][1]" /> \
      </xsl:otherwise>\
    </xsl:choose>
 
rattext_Dsi=<xsl:variable name="count" select="count(//layer/feature[../name='List 1 Dangerous Substances']) + \
                                               count(//layer/feature[../name='List 2 Dangerous Substances'])"/> \
    <xsl:choose> \
      <xsl:when test="$count &gt; 0" >\
        <xsl:choose> \
          <xsl:when test="//rating/value[../layer='List 1 Dangerous Substances'] + \
            //rating/value[../layer='List 2 Dangerous Substances'] &gt; 0"> \
            <xsl:variable name="rating" select="exmath:max(//rating/value[../layer='List 1 Dangerous Substances']  |          \
                                                                                              //rating/value[../layer='List 2 Dangerous Substances']  )" /> \
\
            <xsl:call-template name="conditional">\
              <xsl:with-param name="conditionalTest" select="count(//rating/altCode[(../layer='List 1 Dangerous Substances' or \
                                                                         ../layer='List 2 Dangerous Substances' ) and \
                                                                       (../value = $rating)][1]) = 0"/>\
              <xsl:with-param name="overrideVariable">override</xsl:with-param>\
              <xsl:with-param name="text" select="//rating/code[(../layer='List 1 Dangerous Substances' or \
                                                                         ../layer='List 2 Dangerous Substances' ) and \
                                                                       (../value = $rating)][1]"/>\
              <xsl:with-param name="altText" select="//rating/altCode[(../layer='List 1 Dangerous Substances' or \
                                                                         ../layer='List 2 Dangerous Substances' ) and \
                                                                       (../value = $rating)][1]"/>\
            </xsl:call-template>\
          </xsl:when> \
          <xsl:otherwise> \
            <xsl:value-of select ="//rating/code[(../layer='List 1 Dangerous Substances' or \
                                                  ../layer='List 2 Dangerous Substances')][1]" /> \
          </xsl:otherwise> \
        </xsl:choose> \
      </xsl:when>  \
      <xsl:otherwise> \
        GroundSure has searched this database and no data was found. No further action is recommended.\
      </xsl:otherwise> \
    </xsl:choose>
 
comahcount500=<xsl:choose> \
      <xsl:when test="count(//layer/feature[../name='COMAH Sites']) &gt; 0">Yes</xsl:when> \
      <xsl:otherwise>No</xsl:otherwise> \
    </xsl:choose>
 
rattext_Comah=<xsl:variable name="count" select="count(//layer/feature[../name='COMAH Sites'])"/> \
    <xsl:choose> \
      <xsl:when test="$count &gt; 0"> \
\
            <xsl:call-template name="conditional">\
              <xsl:with-param name="conditionalTest" select="count(//rating/altCode[../layer='COMAH Sites']) = 0"/>\
              <xsl:with-param name="overrideVariable">override</xsl:with-param>\
              <xsl:with-param name="text" select="//rating/code[../layer='COMAH Sites']"/>\
              <xsl:with-param name="altText" select="//rating/altCode[../layer='COMAH Sites']"/>\
            </xsl:call-template>\
      </xsl:when> \
      <xsl:otherwise> \
        GroundSure has searched this database and no data was found. No further action is recommended.\
      </xsl:otherwise> \
    </xsl:choose>
 
NDF_GW_tag=<xsl:if test="count(//layer/feature[../name='GWV']) = 0">Database searched and no data found.</xsl:if>
 
GW=<xsl:choose> \
      <xsl:when test="count(//layer/feature[../name='GWV']) &gt; 0">Yes</xsl:when> \
      <xsl:otherwise>No</xsl:otherwise> \
    </xsl:choose>
 
GW_Rows=#_rows_#<xsl:variable name="count" select="count(//layer/feature[../name='GWV'])"/> \
    <xsl:choose> \
      <xsl:when test="$count &gt; 0"><xsl:value-of select="$count" />#</xsl:when> \
      <xsl:otherwise>#DELETE#</xsl:otherwise> \
    </xsl:choose>
 
GW_Distance=<xsl:for-each select="//layer/feature/distance[../../name='GWV']" > \
      <xsl:text>~</xsl:text><xsl:value-of select="." /> \
    </xsl:for-each>
 
GW_Dir=<xsl:for-each select="//layer/feature/direction[../../name='GWV']" > \
      <xsl:text>~</xsl:text><xsl:value-of select="." /> \
    </xsl:for-each>
 
GW_Clas=<xsl:for-each select="//layer/feature/attribute/value[../../../name='GWV']" > \
      <xsl:text>~</xsl:text><xsl:value-of select="self::node()[../name='Classification1']"/> \
    </xsl:for-each>
 
Abstract=<xsl:choose> \
      <xsl:when test="count(//layer/feature[../name='Abstractions']) &gt; 0">Yes</xsl:when> \
      <xsl:otherwise>No</xsl:otherwise> \
    </xsl:choose>
 
RQ=<xsl:choose> \
      <xsl:when test="count(//layer/feature[../name='River']) &gt; 0">Yes</xsl:when> \
      <xsl:otherwise>No</xsl:otherwise> \
    </xsl:choose>
 
RQ_Rows=#_rows_#<xsl:variable name="count" select="count(//layer/feature[../name='River'])" /> \
    <xsl:choose> \
      <xsl:when test="$count &gt; 0"><xsl:value-of select="$count" />#</xsl:when> \
      <xsl:otherwise>#DELETE#</xsl:otherwise> \
    </xsl:choose>
 
RQ_Dist=<xsl:for-each select="//layer/feature/distance[../../name='River']" > \
      <xsl:text>~</xsl:text><xsl:value-of select="." /> \
    </xsl:for-each>
 
RQ_Dir=<xsl:for-each select="//layer/feature/direction[../../name='River']" > \
      <xsl:text>~</xsl:text><xsl:value-of select="." /> \
    </xsl:for-each>
 
RQ_River_Name=<xsl:for-each select="//layer/feature/attribute/value[../../../name='River']" > \
      <xsl:text>~</xsl:text><xsl:value-of select="self::node()[../name='River']" /> \
    </xsl:for-each>
 
RQ_Reach=<xsl:for-each select="//layer/feature/attribute/value[../../../name='River']" > \
      <xsl:text>~</xsl:text><xsl:value-of select="self::node()[../name='Reach']" /> \
    </xsl:for-each>
 
RQ_Chem=<xsl:for-each select="//layer/feature/attribute/value[../../../name='River']" > \
      <xsl:text>~</xsl:text><xsl:value-of select="self::node()[../name='ChemicalGrade']" /> \
    </xsl:for-each>
 
RQ_Bio=<xsl:for-each select="//layer/feature/attribute/value[../../../name='River']" > \
      <xsl:text>~</xsl:text><xsl:value-of select="self::node()[../name='BiologicalGrade']" /> \
    </xsl:for-each>
 
ratvalue_AQ=\
            <xsl:call-template name="conditional">\
              <xsl:with-param name="conditionalTest" select="count(//rating/altDescription[../layer='Air Quality']) = 0"/>\
              <xsl:with-param name="overrideVariable">override</xsl:with-param>\
              <xsl:with-param name="text" select="//rating/description[../layer='Air Quality']"/>\
              <xsl:with-param name="altText" select="//rating/altDescription[../layer='Air Quality']"/>\
            </xsl:call-template>\
 
AQ_Rows=#_rows_#<xsl:variable name="count" select="count(//layer/feature[../name='Air Quality'])" /> \
    <xsl:choose> \
      <xsl:when test="$count &gt; 0"> \
        <xsl:value-of select="$count"/># \
      </xsl:when> \
        <xsl:otherwise>#DELETE#</xsl:otherwise> \
    </xsl:choose>
 
AQ_Dist=<xsl:for-each select="//layer/feature/distance[../../name='Air Quality']"><xsl:text>~</xsl:text><xsl:value-of select="."/></xsl:for-each>
 
AQ_Dir=<xsl:for-each select="//layer/feature/direction[../../name='Air Quality']"><xsl:text>~</xsl:text><xsl:value-of select="."/></xsl:for-each>
 
AQ_CO=<xsl:for-each select="//layer/feature/attribute/value[../../../name='Air Quality']" > \
      <xsl:text>~</xsl:text><xsl:value-of select="self::node()[../name='CO_Rating']" /> \
    </xsl:for-each>
 
AQ_NO=<xsl:for-each select="//layer/feature/attribute/value[../../../name='Air Quality']" > \
      <xsl:text>~</xsl:text><xsl:value-of select="self::node()[../name='NO_Rating']" /> \
    </xsl:for-each>
 
AQ_PM10=<xsl:for-each select="//layer/feature/attribute/value[../../../name='Air Quality']" > \
      <xsl:text>~</xsl:text><xsl:value-of select="self::node()[../name='PM10_Rating']" /> \
    </xsl:for-each>
 
AQ_SO=<xsl:for-each select="//layer/feature/attribute/value[../../../name='Air Quality']" > \
      <xsl:text>~</xsl:text><xsl:value-of select="self::node()[../name='SO_Rating']" /> \
    </xsl:for-each>
 
AQ_VOC=<xsl:for-each select="//layer/feature/attribute/value[../../../name='Air Quality']" > \
      <xsl:text>~</xsl:text><xsl:value-of select="self::node()[../name='VOC_Rating']" /> \
    </xsl:for-each>
 
AQ=<xsl:choose> \
      <xsl:when test="count(//layer/feature[../name='Air Quality']) &gt; 0">Yes</xsl:when> \
      <xsl:otherwise>No</xsl:otherwise> \
    </xsl:choose>
 
AQMA=
    <xsl:choose> \
      <xsl:when test="count(//layer/feature[../name='Air Quality']) &gt; 0">Yes</xsl:when> \
      <xsl:otherwise>No</xsl:otherwise> \
    </xsl:choose>
 
AQMA_detail=
 
#map#PastLanduse
 
PastLanduse_Count=<xsl:variable name="count" select="count(//layer/feature[../name='LM_History']) + \
								count(//layer/feature[../name='GS_History_25']) + \
								count(//layer/feature[../name='LM_Infilled']) " /> \
    <xsl:choose> \
      <xsl:when test="$count = 0">#DELETE#</xsl:when> \
    </xsl:choose>
 
NDF_LM_tag=<xsl:if test="count(//layer/feature[../name='LM_History']) = 0">Database searched and no data found.</xsl:if>
 
LM_Rows=#_rows_#<xsl:variable name="count" select="count(//layer/feature[../name='LM_History'])" /> \
    <xsl:choose> \
      <xsl:when test="$count &gt; 0"> \
        <xsl:value-of select="$count"/># \
      </xsl:when> \
      <xsl:otherwise>#DELETE#</xsl:otherwise> \
    </xsl:choose>
 
LM_id=<xsl:for-each select="//layer/feature[../name='LM_History']">\
  <xsl:text>~</xsl:text>\
  <xsl:choose>\
    <xsl:when test="substring(./@id,1,1)='X' "></xsl:when>\
    <xsl:when test="substring(./@id,1,1)!='N' ">\
      <xsl:value-of select="./@id"/>\
    </xsl:when>\
    <xsl:otherwise>Not shown</xsl:otherwise>\
  </xsl:choose>\
</xsl:for-each>
 
LM_Dist=<xsl:for-each select="//layer/feature/distance[../../name='LM_History']"><xsl:text>~</xsl:text><xsl:value-of select="."/></xsl:for-each>
 
LM_Dir=<xsl:for-each select="//layer/feature/direction[../../name='LM_History']"><xsl:text>~</xsl:text><xsl:value-of select="."/></xsl:for-each>
 
LM_Use=<xsl:for-each select="//layer/feature/attribute/value[../../../name='LM_History']" > \
      <xsl:text>~</xsl:text><xsl:value-of select="self::node()[../name='Use']" /> \
    </xsl:for-each>
 
LM_Date=<xsl:for-each select="//layer/feature/attribute/value[../../../name='LM_History']" > \
      <xsl:text>~</xsl:text><xsl:value-of select="self::node()[../name='Date']" /> \
    </xsl:for-each>
 
NDF_GS_tag=<xsl:variable name="rawapply" select="//layer/feature/attribute/value[ \
                                ../../../name='25inchtest' and ../name='DataAvailable']"/> \
     <xsl:variable name="apply" select="translate($rawapply,'yesno','YESNO')" />\
     <xsl:choose> \
      <xsl:when test="$apply = 'YES'">\
      		<xsl:if test="count(//layer/feature[../name='GS_History_25']) = 0">Database searched and no data found.</xsl:if> \
      </xsl:when> \
      <xsl:otherwise>#DELETE#</xsl:otherwise> \
    </xsl:choose>
 
   
GS_Rows=#_rows_#<xsl:variable name="count" select="count(//layer/feature[../name='GS_History_25'])" /> \
    <xsl:choose> \
      <xsl:when test="$count &gt; 0"> \
        <xsl:value-of select="$count"/># \
      </xsl:when> \
      <xsl:otherwise>#DELETE#</xsl:otherwise> \
    </xsl:choose>
 
GS_id=<xsl:for-each select="//layer/feature[../name='GS_History_25']">\
  <xsl:text>~</xsl:text>\
  <xsl:choose>\
    <xsl:when test="substring(./@id,1,1)='X' "></xsl:when>\
    <xsl:when test="substring(./@id,1,1)!='N' ">\
      <xsl:value-of select="./@id"/>\
    </xsl:when>\
    <xsl:otherwise>Not shown</xsl:otherwise>\
  </xsl:choose>\
</xsl:for-each>
 
GS_Dist=<xsl:for-each select="//layer/feature/distance[../../name='GS_History_25']"><xsl:text>~</xsl:text><xsl:value-of select="."/></xsl:for-each>
 
GS_Dir=<xsl:for-each select="//layer/feature/direction[../../name='GS_History_25']"><xsl:text>~</xsl:text><xsl:value-of select="."/></xsl:for-each>
 
GS_Use=<xsl:for-each select="//layer/feature/attribute/value[../../../name='GS_History_25']" > \
      <xsl:text>~</xsl:text><xsl:value-of select="self::node()[../name='Use']" /> \
    </xsl:for-each>
 
GS_Date=<xsl:for-each select="//layer/feature/attribute/value[../../../name='GS_History_25']" > \
      <xsl:text>~</xsl:text><xsl:value-of select="self::node()[../name='Date']" /> \
    </xsl:for-each>
 
NDF_LM_Fill_tag=<xsl:if test="count(//layer/feature[../name='LM_Infilled']) = 0">Database searched and no data found.</xsl:if>
 
LM_Fill_Rows=#_rows_#<xsl:variable name="count" select="count(//layer/feature[../name='LM_Infilled'])"/> \
           <xsl:choose> \
           <xsl:when test="$count &gt; 0"> \
               <xsl:value-of select="$count" /># \
           </xsl:when> \
           <xsl:otherwise>#DELETE#</xsl:otherwise> \
           </xsl:choose>
 
LM_Fill_id=<xsl:for-each select="//layer/feature[../name='LM_Infilled']">\
  <xsl:text>~</xsl:text>\
  <xsl:choose>\
    <xsl:when test="substring(./@id,1,1)='X' "></xsl:when>\
    <xsl:when test="substring(./@id,1,1)!='N' ">\
      <xsl:value-of select="./@id"/>\
    </xsl:when>\
    <xsl:otherwise>Not shown</xsl:otherwise>\
  </xsl:choose>\
</xsl:for-each>
 
 
# FRONT PAGE
 
AI_Dist=<xsl:for-each select="//layer/feature/distance[../../name='GS_addinfo']"><xsl:text>~</xsl:text><xsl:value-of select="."/></xsl:for-each>
 
AI_Dir=<xsl:for-each select="//layer/feature/direction[../../name='GS_addinfo']"><xsl:text>~</xsl:text><xsl:value-of select="."/></xsl:for-each>
 
 
AI_Rows=#_rows_#<xsl:variable name="count" select="count(//layer/feature[../name='GS_addinfo'])" /> \
    <xsl:choose> \
      <xsl:when test="$count &gt; 0"> \
        <xsl:value-of select="$count"/># \
      </xsl:when> \
      <xsl:otherwise>#DELETE#</xsl:otherwise> \
    </xsl:choose>
 
AI_IDField=<xsl:for-each select="//layer/feature/attribute/value[../../../name='GS_addinfo']" > \
      <xsl:text>~</xsl:text><xsl:value-of select="self::node()[../name='ID']" /> \
    </xsl:for-each>
 
AI_Date=<xsl:for-each select="//layer/feature/attribute/value[../../../name='GS_addinfo']" > \
      <xsl:text>~</xsl:text><xsl:value-of select="self::node()[../name='Last_Updated']" /> \
    </xsl:for-each>
 
AI_Issue=<xsl:for-each select="//layer/feature/attribute/value[../../../name='GS_addinfo']" > \
      <xsl:text>~</xsl:text><xsl:value-of select="self::node()[../name='Issue']" /> \
    </xsl:for-each>
 
AI_Notes=<xsl:for-each select="//layer/feature/attribute/value[../../../name='GS_addinfo']" > \
      <xsl:text>~</xsl:text><xsl:value-of select="self::node()[../name='Notes']" /> \
    </xsl:for-each>
    
RR_Dist=<xsl:for-each select="//layer/feature/distance[../../name='RecentReports']"><xsl:text>~</xsl:text><xsl:value-of select="."/></xsl:for-each>
 
RR_Dir=<xsl:for-each select="//layer/feature/direction[../../name='RecentReports']"><xsl:text>~</xsl:text><xsl:value-of select="."/></xsl:for-each>
    
RR_Rows=#_rows_#<xsl:variable name="count" select="count(//layer/feature[../name='RecentReports'])" /> \
    <xsl:choose> \
      <xsl:when test="$count &gt; 0"> \
        <xsl:value-of select="$count"/># \
      </xsl:when> \
      <xsl:otherwise>#DELETE#</xsl:otherwise> \
    </xsl:choose>
 
Nigel=<xsl:for-each select="//layer/feature/attribute/value[../../../name='RecentReports']" > \
      <xsl:text>~</xsl:text><xsl:value-of select="self::node()[../name='Job_Ref']" /> \
    </xsl:for-each>
 
RR_Report=<xsl:for-each select="//layer/feature/attribute/value[../../../name='RecentReports']" > \
      <xsl:text>~</xsl:text><xsl:value-of select="self::node()[../name='Report_Type']" /> \
    </xsl:for-each>
 
RR_Date=<xsl:for-each select="//layer/feature/attribute/value[../../../name='RecentReports']" > \
      <xsl:text>~</xsl:text><xsl:value-of select="self::node()[../name='Report_Date']" /> \
    </xsl:for-each>
 
RR_Notes=<xsl:for-each select="//layer/feature/attribute/value[../../../name='RecentReports']" > \
      <xsl:text>~</xsl:text><xsl:value-of select="self::node()[../name='Notes']" /> \
    </xsl:for-each>    
 
PW_Dist=<xsl:for-each select="//layer/feature/distance[../../name='GS_pastWork']"><xsl:text>~</xsl:text><xsl:value-of select="."/></xsl:for-each>
 
PW_Dir=<xsl:for-each select="//layer/feature/direction[../../name='GS_pastWork']"><xsl:text>~</xsl:text><xsl:value-of select="."/></xsl:for-each>
        
PW_Rows=#_rows_#<xsl:variable name="count" select="count(//layer/feature[../name='GS_pastWork'])" /> \
    <xsl:choose> \
      <xsl:when test="$count &gt; 0"> \
        <xsl:value-of select="$count"/># \
      </xsl:when> \
      <xsl:otherwise>#DELETE#</xsl:otherwise> \
    </xsl:choose>
 
Hmm=<xsl:for-each select="//layer/feature/attribute/value[../../../name='GS_pastWork']" > \
      <xsl:text>~</xsl:text><xsl:value-of select="self::node()[../name='Job_Ref']" /> \
    </xsl:for-each>
 
PW_Report=<xsl:for-each select="//layer/feature/attribute/value[../../../name='GS_pastWork']" > \
      <xsl:text>~</xsl:text><xsl:value-of select="self::node()[../name='Report_Type']" /> \
    </xsl:for-each>
 
PW_Date=<xsl:for-each select="//layer/feature/attribute/value[../../../name='GS_pastWork']" > \
      <xsl:text>~</xsl:text><xsl:value-of select="self::node()[../name='Report_Date']" /> \
    </xsl:for-each>
 
PW_Type=<xsl:for-each select="//layer/feature/attribute/value[../../../name='GS_pastWork']" > \
      <xsl:text>~</xsl:text><xsl:value-of select="self::node()[../name='comm_or_res']" /> \
    </xsl:for-each> 
    
Sites_Dist=<xsl:for-each select="//layer/feature/distance[../../name='sites']"><xsl:text>~</xsl:text><xsl:value-of select="."/></xsl:for-each>
 
Sites_Dir=<xsl:for-each select="//layer/feature/direction[../../name='sites']"><xsl:text>~</xsl:text><xsl:value-of select="."/></xsl:for-each>
       
    
Sites_Rows=#_rows_#<xsl:variable name="count" select="count(//layer/feature[../name='sites'])" /> \
    <xsl:choose> \
      <xsl:when test="$count &gt; 0"> \
        <xsl:value-of select="$count"/># \
      </xsl:when> \
      <xsl:otherwise>#DELETE#</xsl:otherwise> \
    </xsl:choose>
 
SitesReport=<xsl:for-each select="//layer/feature/attribute/value[../../../name='sites']" > \
      <xsl:text>~</xsl:text><xsl:value-of select="self::node()[../name='ReportReference']" /> \
    </xsl:for-each>
 
        
######
 
 
LM_Fill_Dist=<xsl:for-each select="//layer/feature/distance[../../name='LM_Infilled']"><xsl:text>~</xsl:text><xsl:value-of select="."/></xsl:for-each>
 
LM_Fill_Dir=<xsl:for-each select="//layer/feature/direction[../../name='LM_Infilled']"><xsl:text>~</xsl:text><xsl:value-of select="."/></xsl:for-each>
 
LM_Fill_Use=<xsl:for-each select="//layer/feature/attribute/value[../../../name='LM_Infilled']" > \
			<xsl:text>~</xsl:text><xsl:value-of select="self::node()[../name='Use']" /> \
		 </xsl:for-each>
 
LM_Fill_Date=<xsl:for-each select="//layer/feature/attribute/value[../../../name='LM_Infilled']" > \
			<xsl:text>~</xsl:text><xsl:value-of select="self::node()[../name='Date']" /> \
		 </xsl:for-each>
 
#map#LandfillWaste
 
LandfillWaste_Count=<xsl:variable name="lfcount" select="count(//layer/feature[../name='Technos Operational Landfills']) + \
								count(//layer/feature[../name='Technos Closed Landfills']) + \
								count(//layer/feature[../name='BGS Landfills']) + \
								count(//layer/feature[../name='GS Landfills']) + \
								count(//layer/feature[../name='Regis']) + \
								count(//layer/feature[../name='EA Closed Landfills']) + \
								count(//layer/feature[../name='EA Landfills'])"/> \
	<xsl:variable name="wastecount" select="count(//layer/feature[../name='Technos Operational Waste Sites']) + \
									      count(//layer/feature[../name='Technos Closed Waste Sites'])"/> \
	<xsl:variable name="count"	select="$lfcount + $wastecount" /> \
           <xsl:choose> \
           <xsl:when test="$count = 0">#DELETE#</xsl:when> \
           </xsl:choose>
 
NDF_Technos_Landfill_tag=<xsl:if test="count(//layer/feature[../name='Technos Operational Landfills']) + \
                          count(//layer/feature[../name='Technos Closed Landfills']) = 0">Database searched and no data found.</xsl:if>
	   
Technos_Landfill_Rows=#_rows_#<xsl:variable name="count" select="count(//layer/feature[../name='Technos Operational Landfills']) + \
								count(//layer/feature[../name='Technos Closed Landfills'])" /> \
           <xsl:choose> \
           <xsl:when test="$count &gt; 0"> \
               <xsl:value-of select="$count"/># \
           </xsl:when> \
           <xsl:otherwise>#DELETE#</xsl:otherwise> \
           </xsl:choose>
 
Technos_Landfill_id=<xsl:for-each select="//layer/feature[../name='Technos Operational Landfills'] | \
                                          //layer/feature[../name='Technos Closed Landfills']">\
  <xsl:text>~</xsl:text>\
  <xsl:choose>\
    <xsl:when test="substring(./@id,1,1)='X' "></xsl:when>\
    <xsl:when test="substring(./@id,1,1)!='N' ">\
      <xsl:value-of select="./@id"/>\
    </xsl:when>\
    <xsl:otherwise>Not shown</xsl:otherwise>\
  </xsl:choose>\
</xsl:for-each>
 
Technos_Landfill_Dist=<xsl:for-each select="//layer/feature/distance[../../name='Technos Operational Landfills'] | \
                                            //layer/feature/distance[../../name='Technos Closed Landfills']">\
    <xsl:text>~</xsl:text><xsl:value-of select="."/></xsl:for-each>
 
Technos_Landfill_Dir=<xsl:for-each select="//layer/feature/direction[../../name='Technos Operational Landfills'] | \
                                           //layer/feature/direction[../../name='Technos Closed Landfills']"> \
			<xsl:text>~</xsl:text><xsl:value-of select="."/> \
		 </xsl:for-each>
 
Technos_Landfill_Address=<xsl:for-each select="//layer/feature/attribute/value[../../../name='Technos Operational Landfills'] | \
                                               //layer/feature/attribute/value[../../../name='Technos Closed Landfills']"> \
			<xsl:text>~</xsl:text><xsl:value-of select="self::node()[../name='SiteAddress']"/> \
		 </xsl:for-each>
 
Technos_Landfill_RegulatorNumber=<xsl:for-each select="//layer/feature/attribute/value[../../../name='Technos Operational Landfills'] | \
									 //layer/feature/attribute/value[../../../name='Technos Closed Landfills']"> \
      <xsl:text>~</xsl:text><xsl:value-of select="self::node()[../name='RegulatorName']"/>\
    </xsl:for-each>
 
 
Technos_Landfill_Status=<xsl:for-each select="//layer/feature/attribute/value[../../../name='Technos Operational Landfills'] | \
                                              //layer/feature/attribute/value[../../../name='Technos Closed Landfills']"> \
			<xsl:text>~</xsl:text><xsl:value-of select="self::node()[../name='Status']"/> \
		 </xsl:for-each>
 
Technos_Landfill_Wastetype=<xsl:for-each select="//layer/feature/attribute/value[../../../name='Technos Operational Landfills'] | \
                                                 //layer/feature/attribute/value[../../../name='Technos Closed Landfills']"> \
			<xsl:text>~</xsl:text><xsl:value-of select="self::node()[../name='MostDifficultWaste']"/> \
		 </xsl:for-each>
 
NDF_BGS_Landfill_tag=<xsl:if test="count(//layer/feature[../name='BGS Landfills']) = 0">Database searched and no data found.</xsl:if>
 
BGS_Landfill_Rows=#_rows_#<xsl:variable name="count" select="count(//layer/feature[../name='BGS Landfills'])"/> \
           <xsl:choose> \
           <xsl:when test="$count &gt; 0" >  \
               <xsl:value-of select="$count" />#  \
           </xsl:when>  \
           <xsl:otherwise>#DELETE#</xsl:otherwise>  \
           </xsl:choose>
 
BGS_Landfill_id=<xsl:for-each select="//layer/feature[../name='BGS Landfills']"> \
  <xsl:text>~</xsl:text>\
  <xsl:choose>\
    <xsl:when test="substring(./@id,1,1)='X' "></xsl:when>\
    <xsl:when test="substring(./@id,1,1)!='N' ">\
      <xsl:value-of select="./@id"/>\
    </xsl:when>\
    <xsl:otherwise>Not shown</xsl:otherwise>\
  </xsl:choose>\
</xsl:for-each>
 
BGS_Landfill_Dist=<xsl:for-each select="//layer/feature/distance[../../name='BGS Landfills']"> \
			<xsl:text>~</xsl:text><xsl:value-of select="."/> \
		 </xsl:for-each>
 
BGS_Landfill_Dir=<xsl:for-each select="//layer/feature/direction[../../name='BGS Landfills']"> \
			<xsl:text>~</xsl:text><xsl:value-of select="."/> \
		 </xsl:for-each>
 
BGS_Landfill_Address=<xsl:for-each select="//layer/feature/attribute/value[../../../name='BGS Landfills']"> \
			<xsl:text>~</xsl:text><xsl:value-of select="self::node()[../name='SiteName']"/> \
		 </xsl:for-each>
 
BGS_Landfill_Risk=<xsl:for-each select="//layer/feature/attribute/value[../../../name='BGS Landfills']"> \
			<xsl:text>~</xsl:text><xsl:value-of select="self::node()[../name='Risk']"/> \
		 </xsl:for-each>
 
BGS_Landfill_Number=<xsl:for-each select="//layer/feature/attribute/value[../../../name='BGS Landfills']"> \
			<xsl:text>~</xsl:text><xsl:value-of select="self::node()[../name='BGSNumber']"/> \
		 </xsl:for-each>
 
BGS_Landfill_Wastetype=<xsl:for-each select="//layer/feature/attribute/value[../../../name='BGS Landfills']"> \
			<xsl:text>~</xsl:text><xsl:value-of select="self::node()[../name='Waste']"/> \
		 </xsl:for-each>
 
NDF_EA_Landfill_tag=<xsl:if test="count(//layer/feature[../name='EA Landfills']) = 0">Database searched and no data found.</xsl:if>
 
EA_Landfill_Rows=#_rows_#<xsl:variable name="count" select="count(//layer/feature[../name='EA Landfills'])"/> \
    <xsl:choose> \
      <xsl:when test="$count &gt; 0" ><xsl:value-of select="$count" />#</xsl:when> \
      <xsl:otherwise>#DELETE#</xsl:otherwise> \
    </xsl:choose>
 
EA_Landfill_id=<xsl:for-each select="//layer/feature[../name='EA Landfills']">\
  <xsl:text>~</xsl:text>\
  <xsl:choose>\
    <xsl:when test="substring(./@id,1,1)='X' "></xsl:when>\
    <xsl:when test="substring(./@id,1,1)!='N' ">\
      <xsl:value-of select="./@id"/>\
    </xsl:when>\
    <xsl:otherwise>Not shown</xsl:otherwise>\
  </xsl:choose>\
</xsl:for-each>
 
EA_Landfill_Dist=<xsl:for-each select="//layer/feature/distance[../../name='EA Landfills']">\
      <xsl:text>~</xsl:text><xsl:value-of select="."/> \
    </xsl:for-each>
 
EA_Landfill_Dir=<xsl:for-each select="//layer/feature/direction[../../name='EA Landfills']"> \
      <xsl:text>~</xsl:text><xsl:value-of select="."/> \
    </xsl:for-each>
 
EA_Landfill_Address=<xsl:for-each select="//layer/feature/attribute/value[../../../name='EA Landfills']"> \
      <xsl:text>~</xsl:text><xsl:value-of select="self::node()[../name='Address']"/> \
    </xsl:for-each>
 
EA_Landfill_Operator=<xsl:for-each select="//layer/feature/attribute/value[../../../name='EA Landfills']"> \
      <xsl:text>~</xsl:text><xsl:value-of select="self::node()[../name='Operator']"/> \
    </xsl:for-each>
 
EA_Landfill_Reference=<xsl:for-each select="//layer/feature/attribute/value[../../../name='EA Landfills']" > \
      <xsl:text>~</xsl:text><xsl:value-of select="self::node()[../name='Lic_wml']"/> \
    </xsl:for-each>
 
EA_Landfill_Regis_Reference=<xsl:for-each select="//layer/feature/attribute/value[../../../name='EA Landfills']" > \
      <xsl:text>~</xsl:text><xsl:value-of select="self::node()[../name='Regis_code']"/> \
    </xsl:for-each>
 
 
 
NDF_EA_CLandfill_tag=<xsl:if test="count(//layer/feature[../name='EA Closed Landfills']) = 0">Database searched and no data found.</xsl:if>
 
EA_CLandfill_Rows=#_rows_#<xsl:variable name="count" select="count(//layer/feature[../name='EA Closed Landfills'])"/> \
    <xsl:choose> \
      <xsl:when test="$count &gt; 0" ><xsl:value-of select="$count" />#</xsl:when> \
      <xsl:otherwise>#DELETE#</xsl:otherwise> \
    </xsl:choose>
 
EA_CLandfill_id=<xsl:for-each select="//layer/feature[../name='EA Closed Landfills']" > \
  <xsl:text>~</xsl:text>\
  <xsl:choose>\
    <xsl:when test="substring(./@id,1,1)='X' "></xsl:when>\
    <xsl:when test="substring(./@id,1,1)!='N' ">\
      <xsl:value-of select="./@id"/>\
    </xsl:when>\
    <xsl:otherwise>Not shown</xsl:otherwise>\
  </xsl:choose>\
</xsl:for-each>
 
EA_CLandfill_Dist=<xsl:for-each select="//layer/feature/distance[../../name='EA Closed Landfills']" > \
      <xsl:text>~</xsl:text><xsl:value-of select="."/> \
    </xsl:for-each>
 
EA_CLandfill_Dir=<xsl:for-each select="//layer/feature/direction[../../name='EA Closed Landfills']"> \
      <xsl:text>~</xsl:text><xsl:value-of select="."/> \
    </xsl:for-each>
 
EA_CLandfill_Address=<xsl:for-each select="//layer/feature/attribute/value[../../../name='EA Closed Landfills']"> \
      <xsl:text>~</xsl:text><xsl:value-of select="self::node()[../name='SiteName']"/> \
    </xsl:for-each>
 
EA_CLandfill_Reference=<xsl:for-each select="//layer/feature/attribute/value[../../../name='EA Closed Landfills']" > \
      <xsl:text>~</xsl:text><xsl:value-of select="self::node()[../name='SiteReference']"/> \
    </xsl:for-each>
 
EA_CLandfill_Regis_Reference=<xsl:for-each select="//layer/feature/attribute/value[../../../name='EA Closed Landfills']" > \
      <xsl:text>~</xsl:text><xsl:value-of select="self::node()[../name='DataType']"/> \
    </xsl:for-each>
 
EA_CLandfill_WT=<xsl:for-each select="//layer/feature/attribute/value[../../../name='EA Closed Landfills']" > \
      <xsl:text>~</xsl:text><xsl:value-of select="self::node()[../name='Type']"/> \
    </xsl:for-each>
    
EA_CLandfill_CM=<xsl:for-each select="//layer/feature/attribute/value[../../../name='EA Closed Landfills']" > \
      <xsl:text>~</xsl:text><xsl:value-of select="self::node()[../name='Gas_Control_and_Leachate']"/> \
    </xsl:for-each>           
 
 
 
 
NDF_Technos_Waste_tag=<xsl:if test="count(//layer/feature[../name='Technos Operational Waste Sites']) + \
								count(//layer/feature[../name='Technos Closed Waste Sites']) = 0"> \
      Database searched and no data found.</xsl:if>
 
Technos_Waste_Rows=#_rows_#<xsl:variable name="count" select="count(//layer/feature[../name='Technos Operational Waste Sites']) + \
								count(//layer/feature[../name='Technos Closed Waste Sites'])" /> \
    <xsl:choose> \
      <xsl:when test="$count &gt; 0" ><xsl:value-of select="$count" />#</xsl:when> \
      <xsl:otherwise>#DELETE#</xsl:otherwise>  \
    </xsl:choose>
 
Technos_Waste_id=<xsl:for-each select="//layer/feature[../name='Technos Operational Waste Sites'] | \
								//layer/feature[../name='Technos Closed Waste Sites']"> \
  <xsl:text>~</xsl:text>\
  <xsl:choose>\
    <xsl:when test="substring(./@id,1,1)='X' "></xsl:when>\
    <xsl:when test="substring(./@id,1,1)!='N' ">\
      <xsl:value-of select="./@id"/>\
    </xsl:when>\
    <xsl:otherwise>Not shown</xsl:otherwise>\
  </xsl:choose>\
</xsl:for-each>
 
Technos_Waste_Dist=<xsl:for-each select="//layer/feature/distance[../../name='Technos Operational Waste Sites'] | \
								   //layer/feature/distance[../../name='Technos Closed Waste Sites']"> \
      <xsl:text>~</xsl:text><xsl:value-of select="."/> \
    </xsl:for-each>
 
Technos_Waste_Dir=<xsl:for-each select="//layer/feature/direction[../../name='Technos Operational Waste Sites'] | \
								   //layer/feature/direction[../../name='Technos Closed Waste Sites']"> \
      <xsl:text>~</xsl:text><xsl:value-of select="."/> \
    </xsl:for-each>
 
Technos_Waste_Address=<xsl:for-each select="//layer/feature/attribute/value[../../../name='Technos Operational Waste Sites']  |  \
									  //layer/feature/attribute/value[../../../name='Technos Closed Waste Sites']"> \
      <xsl:text>~</xsl:text><xsl:value-of select="self::node()[../name='SiteAddress']"/> \
    </xsl:for-each>
 
Technos_Waste_RegulatorNumber=<xsl:for-each select="//layer/feature/attribute/value[../../../name='Technos Operational Waste Sites']  |  \
				//layer/feature/attribute/value[../../../name='Technos Closed Waste Sites']"> \
      <xsl:text>~</xsl:text><xsl:value-of select="self::node()[../name='RegulatorName']"/>\
    </xsl:for-each>
 
      <xsl:value-of select="self::node()[../name='LicenceReference']"/>)\
 
Technos_Waste_Status=<xsl:for-each select="//layer/feature/attribute/value[../../../name='Technos Operational Waste Sites'] | \
				//layer/feature/attribute/value[../../../name='Technos Closed Waste Sites']"> \
      <xsl:text>~</xsl:text><xsl:value-of select="self::node()[../name='Status']"/> \
    </xsl:for-each>
 
Technos_Waste_Cat=<xsl:for-each select="//layer/feature/attribute/value[../../../name='Technos Operational Waste Sites'] | \
				//layer/feature/attribute/value[../../../name='Technos Closed Waste Sites']"> \
      <xsl:text>~</xsl:text><xsl:value-of select="self::node()[../name='Category']"/> \
    </xsl:for-each>
 
Technos_Waste_Wastetype=<xsl:for-each select="//layer/feature/attribute/value[../../../name='Technos Operational Waste Sites']  |  \
						 //layer/feature/attribute/value[../../../name='Technos Closed Waste Sites']"> \
      <xsl:text>~</xsl:text><xsl:value-of select="self::node()[../name='MostDifficultWaste']"/> \
    </xsl:for-each>
 
#map#Industrial
 
Industrial_Count=<xsl:variable name="count" select="count(//layer/feature[../name='Kellys'])   +  \
                                            count(//layer/feature[../name='UndergroundPipelines'])   + \
											count(//layer/feature[../name='Catalist']) + \
											count(//layer/feature[../name='IPC'])       + \
											count(//layer/feature[../name='LAAPC'])   + \
											count(//layer/feature[../name='RAS12']) + \
											count(//layer/feature[../name='RAS34'])   + \
											count(//layer/feature[../name='List 1 Dangerous Substances']) + \
											count(//layer/feature[../name='List 2 Dangerous Substances']) + \
											count(//layer/feature[../name='COMAH Sites'])   + \
											count(//layer/feature[../name='Discharge Consents']) + \
											count(//layer/feature[../name='Redlist Discharge Consents']) + \
											count(//layer/feature[../name='EPA1990']) + \