Next time please make sure you post the source code of your XML document and not what a browser like IE or Firefox might render as that way you do not post well-formed samples.
So assuming your XML is actually as follows:
Code:
<JobAD Source="BlahBlah" JobAdID="412252" Action="insert/modify" ValidFrom="01/04/2009" ValidTo="01/04/2009" CompanyName="Nursing Home" CompanyID="329334" CompanyAddress1="The Home" CompanyAddressPostNumber="LT32 4LU" CompanyAddressPostName="Denbigh" JobAdPlainText="
PART TIME / FULL TIME COOK
To work in a friendly & caring environment.
Call Sue on 02232 2727362
">
<Miles33>
<Miles33Jobs>
<Job>
<OrganisationName>Nursing Home</OrganisationName>
<ContactName>Sue </ContactName>
<ContactTel>02232 2727362</ContactTel>
<ContactMobile/>
<ContactFax/>
<ContactEmail/>
<WebLink/>
<JobTitle>Care Assistants</JobTitle>
<NoOfPosition>1</NoOfPosition>
<Location>DENBIGH,Denbighshire</Location>
<JobType>Permanent</JobType>
<WorkingHours>Full Time</WorkingHours>
<Salary>£Not available</Salary>
<SalaryFrequency>annually</SalaryFrequency>
<Sectors>
<Name>Social Care</Name>
</Sectors>
<JobRef/>
<ClosingDate>2007-07-24T16:36:38.2950140+01:00</ClosingDate>
<HasClosingDate>false</HasClosingDate>
<Description>Care Assistants</Description>
</Job>
</Miles33Jobs>
</Miles33>
</JobAD>
then the following XSLT 2.0 stylesheet
Code:
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="2.0">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="JobAD">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates select="Miles33/Miles33Jobs/Job/*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="Miles33/Miles33Jobs/Job/*[not(*)]">
<xsl:attribute name="{name()}" select="."/>
</xsl:template>
<xsl:template match="Miles33/Miles33Jobs/Job/*[*]">
<xsl:apply-templates select="*"/>
</xsl:template>
<xsl:template match="Miles33/Miles33Jobs/Job/*/*">
<xsl:attribute name="{concat(name(..), name())}" select="."/>
</xsl:template>
</xsl:stylesheet>
when run with Saxon 9.1 produces the following result:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<JobAD Source="BlahBlah" JobAdID="412252" Action="insert/modify"
ValidFrom="01/04/2009"
ValidTo="01/04/2009"
CompanyName="Nursing Home"
CompanyID="329334"
CompanyAddress1="The Home"
CompanyAddressPostNumber="LT32 4LU"
CompanyAddressPostName="Denbigh"
JobAdPlainText=" PART TIME / FULL TIME COOK To work in a friendly & caring environment. Call Sue on 02232 2727362 "
OrganisationName="Nursing Home"
ContactName="Sue "
ContactTel="02232 2727362"
ContactMobile=""
ContactFax=""
ContactEmail=""
WebLink=""
JobTitle="Care Assistants"
NoOfPosition="1"
Location="DENBIGH,Denbighshire"
JobType="Permanent"
WorkingHours="Full Time"
Salary="£Not available"
SalaryFrequency="annually"
SectorsName="Social Care"
JobRef=""
ClosingDate="2007-07-24T16:36:38.2950140+01:00"
HasClosingDate="false"
Description="Care Assistants"/>