Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Using javascript to capture the output of an anchor to alter a variable

From: "bloctext" <christopher_gibson@-------.--.-->
To: NULL
Date: 7/3/2006 4:52:00 PM

My XSLT stylsheet is intended to output an id attribute, which is a
number from the anchor, named 'controller' and be captured on a
mouseclick to alter the variable in the 'teevee' template. This should
then load a different 'section' in the central pane, named 'centre'.

This is my stylesheet:

<?xml version="1.0" encoding="ISO8859-1"?>

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" />
<xsl:preserve-space elements="*" />
<xsl:template match="cv">
 <html>
  <head>
   <title>
    <xsl:text>CV: </xsl:text>

      <xsl:value-of select="section[1]/personalName"/>

	 </title>
  </head>
  <body>

   <table>
    <tr>
	 <td width="100%" colspan="3">
   <xsl:call-template name="top"/>
      </td>
	  </tr>
	  <tr>
	  <td width="20%" class="borderbox" title="borderbox" id="left">
	  <xsl:call-template name="address"/>
	  </td>
	  <td width="60%" class="main" title="main" id="centre">
	  <xsl:call-template name="teevee"/>
	  </td>
	  <td width="20%" class="borderbox" title="borderbox" id="right">
	  <xsl:call-template name="portfolio"/>
	  </td>
	  </tr>
	  </table>
  </body>
 </html>
</xsl:template>
<xsl:template name="top">
 <xsl:for-each select="section">
  <span title="{name/@desc}" class="button">
   <a name="controller" id="{@id}">
<xsl:value-of select="child::name"/>
   </a>
  </span>
  <xsl:if test="not(position()=last())">
       <xsl:text> | </xsl:text>
      </xsl:if>
</xsl:for-each>
	 <h1 title="{section[1]/personalName}"
class="{name(section[1]/personalName)}">

	<xsl:value-of select="section[1]/personalName"/></h1>
	<span title="{name(section[1]/objective)}"
class="{name(section[1]/objective)}"><xsl:value-of
select="section[1]/objective"/></span>
    <hr/></xsl:template>

	<xsl:template name="address">

	  <h2 title="{section[2]/name/@desc}" class="{name(section[2]/name)}">
	   <xsl:value-of select="section[2]/name"/>
	  </h2>
	  <span title="{name(section[2]/name/@desc)}"
class="{name(section[2]/name)}">
	   <xsl:text>Address: </xsl:text>
	   <p title="{name(section[2]/address/houseName)}">
	   <xsl:value-of select="section[2]/address/houseName"/>
	   </p>
	   <p title="{name(section[2]/address/address)}">
	   <xsl:value-of select="section[2]/address/address"/>
	   </p>
	   <p title="{name(section[2]/address/town)}">
	   <xsl:value-of select="section[2]/address/town"/>
	   </p>
	   <p title="{name(section[2]/address/postcode)}">
	   <xsl:value-of select="section[2]/address/postcode"/>
	   </p>
	  </span>
	  <span title="{name(section/telephone)}"
class="{name(section/telephone)}">
	   <xsl:text>Telephone: </xsl:text>
	   <p title="{name(section[2]/telephone/land)}">
	   <xsl:value-of select="section[2]/telephone/land"/>
	   </p>
	   <p title="{name(section[2]/telephone/mobile)}">
	   <xsl:value-of select="section[2]/telephone/mobile"/>
	   </p>
	   <p title="{name(section[2]/telephone/work)}">
	   <xsl:value-of select="section[2]/telephone/work"/>
	   </p>
	  </span>
	  <span title="{name(section[2]/email)}"
class="{name(section[2]/email)}">
	   <xsl:text>Email: </xsl:text><p title="{name(section[2]/email)}"
class="{name(section[2]/email)}"><xsl:value-of
select="section[2]/email"/></p>
	   </span>

	   </xsl:template>

	  <xsl:template name="portfolio"><h2 title="section[11]/name/@desc"
class="{name(section[11]/name)}">
	  <xsl:value-of select="section[11]/name"/>
	  </h2>
	  <xsl:for-each select="section[11]/period">

	  <span title="{name()}" class="{name()}">
	  <h3 title="{name(periodName)}">
	  <xsl:value-of select="periodName"/>
	  	</h3>
		<p title="{name(date)}" class="{name(date)}">
	  <xsl:value-of select="date/from"/> - <xsl:value-of
select="date/to"/>
	  </p>
	  <p title="{name(groups)}" class="{name(groups)}">
	  <xsl:value-of select="groups"/>
	  </p>
	  <p title="{name(project)}" class="{name(project)}">
	  <xsl:value-of select="project"/>
	  </p>
	  </span>
	  </xsl:for-each>
	  </xsl:template>
	  <xsl:template name="teevee">
	  <xsl:param name="channel" select="3"/>
	  <xsl:value-of select="section[$channel]"/>
	  <script type="text/javascript">

document.getElementByName("controller").onClick=document.getElementByName("channel").value=document.write("channel");
</script>
	  </xsl:template>






</xsl:stylesheet>

And this is my XML:

<?xml version="1.0" encoding ="ISO-8859-1"?>
<!DOCTYPE cv SYSTEM "cv.dtd">
<?xml-stylesheet type="text/xsl" href="../stylesheets/cvlayout.xsl"?>


<cv>
 <section id="1">
  <name idref="intro" desc="name, objectives and
contents">Introduction</name>
  <description></description>
  <personalName>
   <firstName>Christopher</firstName>
   <secondName>Arthur</secondName>
   <surname>Gibson</surname>
  </personalName>
  <objective>Build a portfolio of web designs. Apply skills to a social
context. Learn what makes a succesful business. Run own successful web
design business for social context</objective>
 </section>
 <section id="2">
  <name idref="address" desc="contact details for Chris">Contact
details</name>
  <description></description>
  <address>
   <houseName>the Bunker</houseName>
   <address>13 Marriners Drive</address>
   <town>Bradford</town>
   <postcode>BD9 4JT</postcode>
  </address>
  <telephone>
   <land></land>
   <mobile>07891144758</mobile>
   <work></work>
   </telephone>
  <email>christopher_gibson@h...</email>
 </section>
 <section id="3">
  <name idref="education" desc="What Chris has
learned">Education</name>
  <description></description>
  <period>
   <periodName>IT at Luton</periodName>
   <date>
    <from>February 2004</from>
    <to>June 2005</to>
   </date>
   <institution>Luton University</institution>
   <subject>MSc Internet Technologies</subject>
   <result>Distinction</result>
   <activities>
    <dissertation>XML based adaptive e-learning web site for local
school. Utilised XSLT stylesheet to dynamically adapt content to user's
psychological profiles. Psychological profiles based on modern
pedagogies. Allowed pupils to complete one module of IT GCSE partially
or entirely online, at their own pace and and in their own way. I
developed both content and code. Content included activities,
assessment using forms and learning resources.</dissertation>
    <module>Java key cracker application that calculated length of key
in a polyalphabetic cipher string.</module>
    <module>Java and VB.NET applications that acted as GUI for video
library database</module>
    <module>Internet media design using Macromedia Fireworks. Created
two interactive websites for local environmental charity BEES.</module>
    <module>SQL database administration.</module>
    <module>E-commerce heuristic evaluation. Practical application in
XML.</module>
    <module>Text and number manipulation programmes in Perl.</module>
    <module>Linux system administration. Shell script for programming
in Linux.</module>
    <module>Network implementation on Windows NT and XP. Design and
implement network for African schools.</module>
    <module>Original research into biometrics implementation for UK
passport and ID cards scheme.</module>
   </activities>
  </period>
  <period>
   <periodName>Politics at Nottingham</periodName>
   <date>
    <from>September 1997</from>
    <to>June 2000</to>
   </date>
   <institution>University of Nottingham</institution>
   <subject>BA Hons Politics</subject>
   <result>2:i</result>
   <activities>
    <dissertation>Green political thought and Utopia.</dissertation>
    <module>Modern political thought, modern political history,
democracy, liberalism, anarchism.</module>
   </activities>
  </period>
  <period>
   <periodName>A-Levels</periodName>
   <date>
    <from>September 1995</from>
    <to>June 1997</to>
   </date>
   <institution>Rhodesway Sixth Form</institution>
   <subject>A-Level Politics, History, General Studies, English
Literature.</subject>
   <result>AAAB</result>
   <activities>School paired reading scheme; Teaching assistant at
Chapel Grange special school; Cricket team; Debating Society; Bradford
Youth Orchestra.</activities>
  </period>
  <period>
   <periodName>GCSEs</periodName>
   <date>
    <from>September 1992</from>
    <to>June 1995</to>
   </date>
   <institution>Rhodesway School</institution>
   <subject>GCSE Double Science, English Language, Music, Maths,
French, Geography, History, English Literature, Design
Technology.</subject>
   <result>3A*4A3B</result>
   <activities>IT club; Cricket teams; School band.</activities>
  </period>
 </section>
 <section id="4">
  <name idref="employment" desc="Chris' jobs">Employment</name>
  <description></description>
  <period>
   <periodName>Temp with Reed Accountancy</periodName>
   <date>
    <from>October 2005</from>
    <to>Present</to>
   </date>
   <employer>
    <employerName>Reed Accountancy</employerName>
    <employerAddress>24-26 Lands Lane, Leeds, LS1 6LB</employerAddress>
    <sector>Motor Insurance</sector>
   </employer>
   <job>
    <title>Accounts Administrator</title>
    <role>Utilise systems to advise customers on appropriate action to
take to receive payment.</role>
    <responsibilities>Answer and log calls providing good customer
service; Read intelligence from database; Capture and approve invoices
on database.</responsibilities>
   </job>
  </period>
  <period>
   <periodName>Wwoof Canada</periodName>
   <date>
    <from>June 2005</from>
    <to>August 2005</to>
   </date>
   <employer>
    <employerName>Wwoof</employerName>
    <employerAddress>Brighton</employerAddress>
    <sector>Organic farming</sector>
   </employer>
   <job>
    <title>Organic farmer</title>
    <role>Travel between locations in Canada; organic worker on farms
in conservation projects.</role>
    <responsibilities>Weeding, planting, composting, feeding animals,
prepraring meals, conservation and building
projects.</responsibilities>
   </job>
  </period>
  <period>
   <periodName>Student Tutor and Reading Assistant: Hastingsbury
School</periodName>
   <date>
    <from>March 2005</from>
    <to>June 2005</to>
   </date>
   <employer>
    <employerName>Hastingsbury School</employerName>
    <employerAddress>Bedford</employerAddress>
    <sector>Education</sector>
   </employer>
   <job>
    <title>STAR: Student Tutor and Reading Support</title>
    <role>Individual tuition to pupils and groups; Classroom
assistance; Technical support.</role>
    <responsibilities>Explain IT concepts to pupils; Offer individual
advice and group guidance; Focus on RDBMS design and administration;
Discipline; Resolve IT problems with desktop
machines.</responsibilities>
   </job>
  </period>
  <period>
   <periodName>Student support at Luton University</periodName>
   <date>
    <from>September 2004</from>
    <to>June 2005</to>
   </date>
   <employer>
    <employerName>Luton University Student Support</employerName>
    <employerAddress>Park Square, Luton, LU1 3JU</employerAddress>
    <sector>Education</sector>
   </employer>
   <job>
    <title>Student Buddy</title>
    <role>Assist blind Computer Sciences student in perception of
visual media.</role>
    <responsibilities>Take notes in lectures for subsequent
explanation; Explain images on monitor that were inaccessible; Input
required content onto machines.</responsibilities>
   </job>
  </period>
  <period>
   <periodName>Tesco stock controller</periodName>
   <date>
    <from>January 2003</from>
    <to>January 2004</to>
   </date>
   <employer>
    <employerName>Tesco</employerName>
    <employerAddress>Bradford</employerAddress>
    <sector>Retail</sector>
   </employer>
   <job>
    <title>Stock controller</title>
    <role>Provide intelligence to colleagues and customers on stock
availability.</role>
    <responsibilities>Access systems using PDA; Maintain accuracy of
documentation on stock availability; Provide good customer
service.</responsibilities>
   </job>
  </period>
  <period>
   <periodName>Oxfam volunteer</periodName>
   <date>
    <from>January 2002</from>
    <to>December 2002</to>
   </date>
   <employer>
    <employerName>Oxfam</employerName>
    <employerAddress>56-58 Darley Street, Bradford</employerAddress>
    <sector>Charity</sector>
   </employer>
   <job>
    <title>Volunteer Deputy Assistant Manager</title>
    <role>Involved in general store maintenance and management
responsibilities when manager and deputy away.</role>
    <responsibilities>Customer service, merchandising, cashing up,
promoting campaigns and activities.</responsibilities>
   </job>
  </period>
  <period>
   <periodName>Conservation volunteer: BEES</periodName>
   <date>
    <from>April 2001</from>
    <to>February 2004</to>
   </date>
   <employer>
    <employerName>BEES - Bradford Environmental Education
Service</employerName>
    <employerAddress>YMCA Building, Bradford</employerAddress>
    <sector>Environment</sector>
   </employer>
   <job>
    <title>Conservation worker</title>
    <role>Active in practical conservation tasks.</role>
    <responsibilities>Making a better environment by improving
locations around Bradford; Learning about the natural
environment.</responsibilities>
   </job>
  </period>
  <period>
   <periodName>Travel in Asia</periodName>
   <date>
    <from>January 2001</from>
    <to>March 2001</to>
   </date>
   <job>
    <title>Travel</title>
  </job>
  </period>
  <period>
   <periodName>Bar work at Clarke's Restaurant</periodName>
   <date>
    <from>September 2000</from>
    <to>December 2000</to>
   </date>
   <employer>
    <employerName>Clarke's Restaurant</employerName>
    <employerAddress>Heaton, Bradford.</employerAddress>
    <sector>Restaurant</sector>
   </employer>
   <job>
    <title>Bar Staff</title>
    <role>Greet customers, serve drinks and provide a warm
welcome.</role>
    <responsibilities>Ensure drink availability to provide drinks
customers required; Table service.</responsibilities>
   </job>
  </period>
  <period>
   <periodName>Corporate environmental conservation</periodName>
   <date>
    <from>June 2000</from>
    <to>September 2000</to>
   </date>
   <employer>
    <employerName>Going for Green</employerName>
    <employerAddress>Nottingham</employerAddress>
    <sector>Environment</sector>
   </employer>
   <job>
    <title>Research Officer</title>
    <role>Provide research support to paid officers for PR and
consultancy services.</role>
    <responsibilities>Read relevant local government publications and
complile statistics based on comparison and analysis; Support during PR
activities and roadshows.</responsibilities>
   </job>
  </period>
  <period>
   <periodName>Parliamentary Assistant</periodName>
   <date>
    <from>March 2000</from>
    <to>April 2000</to>
   </date>
   <employer>
    <employerName>Paddy Tipping MP</employerName>
    <employerAddress>House of Commons, London</employerAddress>
    <sector>Politics</sector>
   </employer>
   <job>
    <title>Parliamentary Assistant</title>
    <role>Assist Paddy in constituency, parliamentary and governmental
activities.</role>
    <responsibilities>Reading communications, ranging from constituency
letters to Hansard and acting on them. Appreciating ambience of
parliament.</responsibilities>
   </job>
  </period>
  <period>
   <periodName>Professional Gourmet Food Consultant</periodName>
   <date>
    <from>June 1999</from>
    <to>September 1999</to>
   </date>
   <employer>
    <employerName>Bon Appetit</employerName>
    <employerAddress>Crawley</employerAddress>
    <sector>Gourmet Food</sector>
   </employer>
   <job>
    <title>Professional Gourmet Food Consultant</title>
    <role>Gourmet food consultancy service to posh folk.</role>
    <responsibilities>Transporting products amongst areas in south
east, cold calling and displaying products, meeting customer needs and
selling prawns.</responsibilities>
   </job>
  </period>
  <period>
   <periodName>Vacation jobs</periodName>
   <date>School and University vacations between 1995 and 1999</date>
   <employer>Factories, offices etc.</employer>
   <job>Hard graft; data entry.</job>
  </period>
 </section>
 <section id="5">
  <name idref="activities" desc="Extra-curricular
activities">Interests</name>
  <description></description>
  <period>
   <periodName>Conservation</periodName>
   <date>
    <from>June 2000</from>
    <to>Presemt</to>
   </date>
   <groups>Going for Green, British Trust for Conservation Volunteers,
WWOOF, Bradford Community Environment Project, Bradford Environmental
Education Project.</groups>
   <activities>Practical conservation tasks and projects in Nottingham
and Bradford, Organic farming at home and abroad, apple day. 10,000
word dissertation on environmental utopianism. Interactive animated web
site advertising work of BEES.</activities>
  </period>
  <period>
   <periodName>Cricket</periodName>
   <date>
    <from>May 1989</from>
    <to>Presemt</to>
   </date>
   <groups>Sandy Lane CC.</groups>
   <activities>Involved in club activities through playing, training
and leading.</activities>
  </period>
  <period>
   <periodName>Education</periodName>
   <date>
    <from>September 2004</from>
    <to>Presemt</to>
   </date>
   <groups>Luton University, Hastingsbury School Bedfordshire.</groups>
   <activities>Disabled student support, Student Tutoring and Reading
Support. Dissertation incorporating original research into learning
styles and adaptable web sites for learning. Produced 15,000 word essay
and original XHTML artefact.</activities>
  </period>
 </section>
 <section id="6">
  <name idref="projects" desc="Original IT projects currently in
progress">Projects</name>
  <description></description>
  <period>
   <periodName>Music production</periodName>
   <project>Programming using synthesisers, sequencers and samplers on
Fruit Loops 6.</project>
  </period>
  <period>
   <periodName>Web Design</periodName>
   <project>Creation of web sites using HTML, XML, XHTML. Scripting
using Java SCript, ASP and PHP. Media design on Fireworks. Involved in
Freelance web site production for business.</project>
  </period>
 </section>
 <section id="7">
  <name idref="skills" desc="Chris's transferable skills from
education, business, and extra curricular.">Skills</name>
  <description></description>
  <period>
   <periodName>Project Development</periodName>
   <activities>Chaired successful groups: implementing a network;
designing a website.</activities>
   <activities>Completed Master's thesis with diverse bodies:
University, School, Supervisor; extensive research; produced unique
artefact. Gained distinction</activities>
   <activities>Carry out freelance projects as part of own web
development company.</activities>
  </period>
  <period>
   <periodName>Commuinication</periodName>
   <activities>Deal with hundred customers a day in current
position.</activities>
   <activities>Successfully explain images to blind IT student as
Student Buddy.</activities>
   <activities>Involved in successful tutoring project with
Hastingsbury School.</activities>
   <activities>Generate material and publish on web site journal. Proof
read material generated by others.</activities>
  </period>
  <period>
   <periodName>Technical Skills</periodName>
   <activities>Web Languages: HTML, XML, XHTML, JavaScript, ASP, PHP,
SQL.</activities>
   <activities>Programming languages: Java, VB.NET, Perl,
Shell.</activities>
   <activities>Network and technical administration for Linux, Windows
NT, Windows XP.</activities>
   <activities>Office advanced skills. Database
administration.</activities>
   <activities>Learning pedagogies.</activities>
  </period>
  <period>
   <periodName>Group activities</periodName>
   <activities>Part of successful team dealing with business
responsibility with Reed.</activities>
   <activities>Volunteer with OXFAM and participate on conservation
projects.</activities>
   <activities>Worked on organic farm projects overseas and
domestic.</activities>
   <activities>Played Cricket for same Yorkshire team for fifteen
years.</activities>
   <activities>Leadership ambitions: have chaired effective groups and
hope to run own Web Development business.</activities>
  </period>
 </section>
 <section id="8">
  <name idref="references" desc="People who will vouch for
me.">References</name>
  <description></description>
  <period>
   <periodName>Dr Yong Yue</periodName>
   <relation>Academic Supervisor</relation>
   <position>Academic Tutor</position>
   <company>
    <name>Luton University</name>
    <address>Department of Computing and Information Systems, Luton
University, Park Square, Luton, LU1 3JU</address>
   </company>
   <compEmail>yong.yue@l...</compEmail>
   <compTel>01582489230</compTel>
  </period>
  <period>
   <periodName>Alexia Catt</periodName>
   <relation>Line manager</relation>
   <position>Reed recruiter</position>
   <company>
    <name>Reed</name>
    <address>24-26 Lands Lane, Leeds, LS1 6LB</address>
   </company>
   <compEmail>alexia.catt@r...</compEmail>
   <compTel>01132459181</compTel>
  </period>
 </section>
 <section id="9">
  <name idref="ambitions" desc="Plans for the future">Ambitions</name>
  <description></description>
  <period>
   <periodName>Develop portfolio of web design.</periodName>
  </period>
  <period>
   <periodName>Specialise in e-learning technologies and develop
interactive games for this purpose.</periodName>
  </period>
  <period>
   <periodName>Head my own company in London doing this.</periodName>
  </period>
 </section>
 <section id="10">
  <name idref="analysis" desc="How I aim to achieve my
ambitions.">Analysis</name>
  <description idref="analysis"></description>
  <period>
   <periodName>Develop web design skills working out of
hours.</periodName>
  </period>
  <period>
   <periodName>Get back involved in more conservation
activities.</periodName>
  </period>
  <period>
   <periodName>Learn Flash skills.</periodName>
  </period>
 </section>
 <section id="11">
  <name idref="portfolio" desc="IT projects I have
completed">Portfolio</name>
  <description></description>
  <period>
   <periodName>Centre Stage folk arts project.</periodName>
   <date>
    <from>May 2006</from>
    <to>June 2006</to>
   </date>
   <groups>Centre Stage</groups>
   <project>Original interactive media design on Fireworks. phpBB
forum.</project>
  </period>
  <period>
   <periodName>Hastingsbury School e-learning artefact</periodName>
   <date>
    <from>September 2004</from>
    <to>June 2005</to>
   </date>
   <groups>Luton University/Hastingsbury School</groups>
   <project>Original adaptable e-learning site in XHTML for year 9
pupils.</project>
  </period>
  <period>
   <periodName>BEES interactive web site</periodName>
   <date>
    <from>Feb 04</from>
    <to>June 04</to>
   </date>
   <groups>Luton University/BEES</groups>
   <project>Two interactive web sites for Bradford Environmental
Education Service created using Macromedia suite.</project>
  </period>
  <period>
   <periodName>Own archived web site</periodName>
   <date>
    <from>September 2004</from>
    <to>June 2005</to>
   </date>
   <groups>Own project</groups>
   <project>Musings etc.</project>
  </period>
 </section>
</cv>

  I cannot get the javascript to capture the output of the anchor. Any
ideas?

Chris



transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent