Bob_Hopes
07-19-2007, 07:01 AM
Hi all could really do with some help urgently...
I was up until 2am working on this problem and have got no where except maybe even more confused!
I am trying to create a survey which will be populated from the following XML.
I am passing this through an xsl file to populate HTML via the attached javascript.
The issue i am having is how do i save the XML as a temp file and edit this via the drop down menu. The selection in menu should be the only node of its fellow siblings visible in the new XML with all other fields (<DVName>,DvcodeNo,<ClaimGroup>,<CustSurveyNo>,<ClaimGroupType>,<QuestionID> etc...) should be the same.
I am then going to pass this xml as a string in called procedure. I am happy with this latter part I think? just need help with the creation and editing of the xml.
I been googling for a while but cant seem to get anything that works. This is my last resort now so any help will be greatly appreciated.
Thanks in advance
a caffeine fuelled novice.
XML...
<?xml version="1.0" encoding="ISO-8859-1"?>
<DivisionName>
<DVName>GB</DVName>
<DvcodeNo>1</DvcodeNo>
<ClaimGroup>
<CustSurveyNo>5</CustSurveyNo>
<ClaimGroupType>Gas</ClaimGroupType>
<Questions>
<QuestionID>100</QuestionID>
<QuestionDesc>Call Abandoned ?</QuestionDesc>
<Answers>
<AnswerID />
<Answer>Didn't Abandoned</Answer>
<Ansoption />
</Answers>
<Answers>
<AnswerID>309</AnswerID>
<Answer>Abandoned</Answer>
<Ansoption />
</Answers>
</Questions>
<Questions>
<QuestionID>83</QuestionID>
<QuestionDesc>Q1. Was your call answered prompt and courteously?</QuestionDesc>
<Answers>
<AnswerID>213</AnswerID>
<Answer>Don't Know</Answer>
<Ansoption />
</Answers>
<Answers>
<AnswerID>214</AnswerID>
<Answer>Yes</Answer>
<Ansoption />
</Answers>
<Answers>
<AnswerID>215</AnswerID>
<Answer>No</Answer>
<Ansoption>
<Options>Time Waiting</Options>
</Ansoption>
<Ansoption>
<Options>Rude/Abrupt</Options>
</Ansoption>
<Ansoption>
<Options>Unhelpful</Options>
</Ansoption>
</Answers>
</Questions>
<Questions>
<QuestionID>84</QuestionID>
<QuestionDesc>Q2. Was our advisor able to understand and help you with the difficulties you were experiencing?</QuestionDesc>
<Answers>
<AnswerID>227</AnswerID>
<Answer>Don't Know</Answer>
<Ansoption />
</Answers>
<Answers>
<AnswerID>228</AnswerID>
<Answer>Yes</Answer>
<Ansoption />
</Answers>
<Answers>
<AnswerID>229</AnswerID>
<Answer>No</Answer>
<Ansoption>
<Options>Wrong Advice</Options>
</Ansoption>
<Ansoption>
<Options>Unable to Agree Claim</Options>
</Ansoption>
<Ansoption>
<Options>Poor Policy/Product Knowledge</Options>
</Ansoption>
<Ansoption>
<Options>Didn't Understand imapct of emergency</Options>
</Ansoption>
</Answers>
</Questions>
<Questions>
<QuestionID>85</QuestionID>
<QuestionDesc>Q3. Did we explain the next steps and that the contractor would contact you within 1 hr to arrange an appointment?</QuestionDesc>
<Answers>
<AnswerID>234</AnswerID>
<Answer>Don't Know</Answer>
<Ansoption />
</Answers>
<Answers>
<AnswerID>235</AnswerID>
<Answer>Yes</Answer>
<Ansoption />
</Answers>
<Answers>
<AnswerID>236</AnswerID>
<Answer>No</Answer>
<Ansoption />
</Answers>
</Questions>
<Questions>
<QuestionID>86</QuestionID>
<QuestionDesc>Q4. How soon after making your claim did the engineer contact you to confirm his attendance time?</QuestionDesc>
<Answers>
<AnswerID>241</AnswerID>
<Answer>Don't Know</Answer>
<Ansoption />
</Answers>
<Answers>
<AnswerID>242</AnswerID>
<Answer>Yes</Answer>
<Ansoption>
<Options>Kept Appointment</Options>
</Ansoption>
<Ansoption>
<Options>Re-Arranged appointment</Options>
</Ansoption>
<Ansoption>
<Options>Late Appointment</Options>
</Ansoption>
<Ansoption>
<Options>Didn't Attend</Options>
</Ansoption>
</Answers>
<Answers>
<AnswerID>243</AnswerID>
<Answer>No</Answer>
<Ansoption>
<Options>Chased</Options>
</Ansoption>
<Ansoption>
<Options>Just turned up</Options>
</Ansoption>
<Ansoption>
<Options>Didn't attend</Options>
</Ansoption>
</Answers>
</Questions>
<Questions>
<QuestionID>87</QuestionID>
<QuestionDesc>Q5. Was your need for an engineer an emergency (immediate need) or where a mutually convenient time could be pre-arranged between you and the contractor?</QuestionDesc>
<Answers>
<AnswerID>250</AnswerID>
<Answer>Yes</Answer>
<Ansoption />
</Answers>
<Answers>
<AnswerID>251</AnswerID>
<Answer>No</Answer>
<Ansoption />
</Answers>
</Questions>
<Questions>
<QuestionID>88</QuestionID>
<QuestionDesc>Q5-a. How soon after making your claim did the engineer attend your property?</QuestionDesc>
<Answers>
<AnswerID>310</AnswerID>
<Answer>Next Day</Answer>
<Ansoption />
</Answers>
<Answers>
<AnswerID>311</AnswerID>
<Answer>24 hrs</Answer>
<Ansoption />
</Answers>
<Answers>
<AnswerID>312</AnswerID>
<Answer>48 hrs</Answer>
<Ansoption />
</Answers>
<Answers>
<AnswerID>313</AnswerID>
<Answer>72 hrs+</Answer>
<Ansoption />
</Answers>
<Answers>
<AnswerID>314</AnswerID>
<Answer>Didn't Arrive</Answer>
<Ansoption />
</Answers>
</Questions>
<Questions>
<QuestionID>89</QuestionID>
<QuestionDesc>Q5-b Did the engineer arrive at the pre-arranged time?</QuestionDesc>
<Answers>
<AnswerID>315</AnswerID>
<Answer>Yes</Answer>
<Ansoption />
</Answers>
<Answers>
<AnswerID>316</AnswerID>
<Answer>No</Answer>
<Ansoption />
</Answers>
</Questions>
<Questions>
<QuestionID>90</QuestionID>
<QuestionDesc>Q5-c How soon after making your claim did the engineer attend your property?</QuestionDesc>
<Answers>
<AnswerID>317</AnswerID>
<Answer>Next Day</Answer>
<Ansoption />
</Answers>
<Answers>
<AnswerID>318</AnswerID>
<Answer>48 hrs</Answer>
<Ansoption />
</Answers>
<Answers>
<AnswerID>319</AnswerID>
<Answer>72 hrs+</Answer>
<Ansoption />
</Answers>
<Answers>
<AnswerID>320</AnswerID>
<Answer>Didn't Arrive</Answer>
<Ansoption />
</Answers>
</Questions>
</ClaimGroup>
</DivisionName>
XSL...
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body background="Redbg.jpg">
<table align="center">
<td align="left">
<h2 align="left"></h2>
</td>
<td width="50%"></td>
<td align="right">
<font face="Gill Sans" color="#ffffff"><h3 align="right">Customer Satisfaction Survey</h3></font>
</td>
</table>
<table bgcolor="White" width="90%" frame="90%" align="center">
<td>
<xsl:apply-templates />
</td>
</table>
</body>
</html>
</xsl:template>
<xsl:template match="Questions">
<h3><label name="Question"><xsl:value-of select="QuestionDesc" /></label></h3>
<select name="Answer">
<option>
Please Select
</option>
<xsl:for-each select="Answers">
<option>
<xsl:value-of select="Answer"/>
</option>
</xsl:for-each>
</select>
<xsl:choose>
<xsl:when test='Answers/Ansoption/Options != "" '>
<select name="option">
<option>
Please Select
</option>
<xsl:for-each select="Answers/Ansoption">
<option>
<xsl:value-of select="Options"/>
</option>
</xsl:for-each>
</select>
</xsl:when>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
HTML/Javascript...
<html>
<head>
</head>
<body>
<form name="survey">
<script type="text/javascript">// Load XML
var xml = new ActiveXObject("Microsoft.XMLDOM");
xml.async = false;
xml.load("Gastest_b.xml");// Load XSL
var xsl = new ActiveXObject("Microsoft.XMLDOM");
xsl.async = false;
xsl.load("water_test.xsl");// Transform
document.write(xml.transformNode(xsl));
</script>
</form>
</body>
</html>
I was up until 2am working on this problem and have got no where except maybe even more confused!
I am trying to create a survey which will be populated from the following XML.
I am passing this through an xsl file to populate HTML via the attached javascript.
The issue i am having is how do i save the XML as a temp file and edit this via the drop down menu. The selection in menu should be the only node of its fellow siblings visible in the new XML with all other fields (<DVName>,DvcodeNo,<ClaimGroup>,<CustSurveyNo>,<ClaimGroupType>,<QuestionID> etc...) should be the same.
I am then going to pass this xml as a string in called procedure. I am happy with this latter part I think? just need help with the creation and editing of the xml.
I been googling for a while but cant seem to get anything that works. This is my last resort now so any help will be greatly appreciated.
Thanks in advance
a caffeine fuelled novice.
XML...
<?xml version="1.0" encoding="ISO-8859-1"?>
<DivisionName>
<DVName>GB</DVName>
<DvcodeNo>1</DvcodeNo>
<ClaimGroup>
<CustSurveyNo>5</CustSurveyNo>
<ClaimGroupType>Gas</ClaimGroupType>
<Questions>
<QuestionID>100</QuestionID>
<QuestionDesc>Call Abandoned ?</QuestionDesc>
<Answers>
<AnswerID />
<Answer>Didn't Abandoned</Answer>
<Ansoption />
</Answers>
<Answers>
<AnswerID>309</AnswerID>
<Answer>Abandoned</Answer>
<Ansoption />
</Answers>
</Questions>
<Questions>
<QuestionID>83</QuestionID>
<QuestionDesc>Q1. Was your call answered prompt and courteously?</QuestionDesc>
<Answers>
<AnswerID>213</AnswerID>
<Answer>Don't Know</Answer>
<Ansoption />
</Answers>
<Answers>
<AnswerID>214</AnswerID>
<Answer>Yes</Answer>
<Ansoption />
</Answers>
<Answers>
<AnswerID>215</AnswerID>
<Answer>No</Answer>
<Ansoption>
<Options>Time Waiting</Options>
</Ansoption>
<Ansoption>
<Options>Rude/Abrupt</Options>
</Ansoption>
<Ansoption>
<Options>Unhelpful</Options>
</Ansoption>
</Answers>
</Questions>
<Questions>
<QuestionID>84</QuestionID>
<QuestionDesc>Q2. Was our advisor able to understand and help you with the difficulties you were experiencing?</QuestionDesc>
<Answers>
<AnswerID>227</AnswerID>
<Answer>Don't Know</Answer>
<Ansoption />
</Answers>
<Answers>
<AnswerID>228</AnswerID>
<Answer>Yes</Answer>
<Ansoption />
</Answers>
<Answers>
<AnswerID>229</AnswerID>
<Answer>No</Answer>
<Ansoption>
<Options>Wrong Advice</Options>
</Ansoption>
<Ansoption>
<Options>Unable to Agree Claim</Options>
</Ansoption>
<Ansoption>
<Options>Poor Policy/Product Knowledge</Options>
</Ansoption>
<Ansoption>
<Options>Didn't Understand imapct of emergency</Options>
</Ansoption>
</Answers>
</Questions>
<Questions>
<QuestionID>85</QuestionID>
<QuestionDesc>Q3. Did we explain the next steps and that the contractor would contact you within 1 hr to arrange an appointment?</QuestionDesc>
<Answers>
<AnswerID>234</AnswerID>
<Answer>Don't Know</Answer>
<Ansoption />
</Answers>
<Answers>
<AnswerID>235</AnswerID>
<Answer>Yes</Answer>
<Ansoption />
</Answers>
<Answers>
<AnswerID>236</AnswerID>
<Answer>No</Answer>
<Ansoption />
</Answers>
</Questions>
<Questions>
<QuestionID>86</QuestionID>
<QuestionDesc>Q4. How soon after making your claim did the engineer contact you to confirm his attendance time?</QuestionDesc>
<Answers>
<AnswerID>241</AnswerID>
<Answer>Don't Know</Answer>
<Ansoption />
</Answers>
<Answers>
<AnswerID>242</AnswerID>
<Answer>Yes</Answer>
<Ansoption>
<Options>Kept Appointment</Options>
</Ansoption>
<Ansoption>
<Options>Re-Arranged appointment</Options>
</Ansoption>
<Ansoption>
<Options>Late Appointment</Options>
</Ansoption>
<Ansoption>
<Options>Didn't Attend</Options>
</Ansoption>
</Answers>
<Answers>
<AnswerID>243</AnswerID>
<Answer>No</Answer>
<Ansoption>
<Options>Chased</Options>
</Ansoption>
<Ansoption>
<Options>Just turned up</Options>
</Ansoption>
<Ansoption>
<Options>Didn't attend</Options>
</Ansoption>
</Answers>
</Questions>
<Questions>
<QuestionID>87</QuestionID>
<QuestionDesc>Q5. Was your need for an engineer an emergency (immediate need) or where a mutually convenient time could be pre-arranged between you and the contractor?</QuestionDesc>
<Answers>
<AnswerID>250</AnswerID>
<Answer>Yes</Answer>
<Ansoption />
</Answers>
<Answers>
<AnswerID>251</AnswerID>
<Answer>No</Answer>
<Ansoption />
</Answers>
</Questions>
<Questions>
<QuestionID>88</QuestionID>
<QuestionDesc>Q5-a. How soon after making your claim did the engineer attend your property?</QuestionDesc>
<Answers>
<AnswerID>310</AnswerID>
<Answer>Next Day</Answer>
<Ansoption />
</Answers>
<Answers>
<AnswerID>311</AnswerID>
<Answer>24 hrs</Answer>
<Ansoption />
</Answers>
<Answers>
<AnswerID>312</AnswerID>
<Answer>48 hrs</Answer>
<Ansoption />
</Answers>
<Answers>
<AnswerID>313</AnswerID>
<Answer>72 hrs+</Answer>
<Ansoption />
</Answers>
<Answers>
<AnswerID>314</AnswerID>
<Answer>Didn't Arrive</Answer>
<Ansoption />
</Answers>
</Questions>
<Questions>
<QuestionID>89</QuestionID>
<QuestionDesc>Q5-b Did the engineer arrive at the pre-arranged time?</QuestionDesc>
<Answers>
<AnswerID>315</AnswerID>
<Answer>Yes</Answer>
<Ansoption />
</Answers>
<Answers>
<AnswerID>316</AnswerID>
<Answer>No</Answer>
<Ansoption />
</Answers>
</Questions>
<Questions>
<QuestionID>90</QuestionID>
<QuestionDesc>Q5-c How soon after making your claim did the engineer attend your property?</QuestionDesc>
<Answers>
<AnswerID>317</AnswerID>
<Answer>Next Day</Answer>
<Ansoption />
</Answers>
<Answers>
<AnswerID>318</AnswerID>
<Answer>48 hrs</Answer>
<Ansoption />
</Answers>
<Answers>
<AnswerID>319</AnswerID>
<Answer>72 hrs+</Answer>
<Ansoption />
</Answers>
<Answers>
<AnswerID>320</AnswerID>
<Answer>Didn't Arrive</Answer>
<Ansoption />
</Answers>
</Questions>
</ClaimGroup>
</DivisionName>
XSL...
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body background="Redbg.jpg">
<table align="center">
<td align="left">
<h2 align="left"></h2>
</td>
<td width="50%"></td>
<td align="right">
<font face="Gill Sans" color="#ffffff"><h3 align="right">Customer Satisfaction Survey</h3></font>
</td>
</table>
<table bgcolor="White" width="90%" frame="90%" align="center">
<td>
<xsl:apply-templates />
</td>
</table>
</body>
</html>
</xsl:template>
<xsl:template match="Questions">
<h3><label name="Question"><xsl:value-of select="QuestionDesc" /></label></h3>
<select name="Answer">
<option>
Please Select
</option>
<xsl:for-each select="Answers">
<option>
<xsl:value-of select="Answer"/>
</option>
</xsl:for-each>
</select>
<xsl:choose>
<xsl:when test='Answers/Ansoption/Options != "" '>
<select name="option">
<option>
Please Select
</option>
<xsl:for-each select="Answers/Ansoption">
<option>
<xsl:value-of select="Options"/>
</option>
</xsl:for-each>
</select>
</xsl:when>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
HTML/Javascript...
<html>
<head>
</head>
<body>
<form name="survey">
<script type="text/javascript">// Load XML
var xml = new ActiveXObject("Microsoft.XMLDOM");
xml.async = false;
xml.load("Gastest_b.xml");// Load XSL
var xsl = new ActiveXObject("Microsoft.XMLDOM");
xsl.async = false;
xsl.load("water_test.xsl");// Transform
document.write(xml.transformNode(xsl));
</script>
</form>
</body>
</html>