473,288 Members | 2,350 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,288 software developers and data experts.

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

I am programming an interactive CV using xml, xslt and java script. The

page consists of a header which contains links to various 'sections' on

the xml cv, a left and right menu, and a central panel. The central
panel is intended to display the main content of the cv: when an anchor

is selected from the header then the detail is supposed to appear. The
javascript is supposed to select the appropriate section 'onclick' and
output it. This is done in template 'teevee'. XSLT:

<?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=do cument.getElementByName("*channel").value=document .write("channel");

</script>
</xsl:template>
</xsl:stylesheet>
I am programming an interactive CV using xml, xslt and java script. The

page consists of a header which contains links to various 'sections' on

the xml cv, a left and right menu, and a central panel. The central
panel is intended to display the main content of the cv: when an anchor

is selected from the header then the detail is supposed to appear. The
javascript is supposed to select the appropriate section 'onclick' and
output it. This is done in template 'teevee'. XSLT:

<?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=do cument.getElementByName("*channel").value=document .write("channel");

</script
</xsl:template
</xsl:stylesheet>

Jul 6 '06 #1
3 2357

Use prototype.js to capture events...
More information here:
http://wiki.script.aculo.us/scriptac.../Event.observe

Jul 6 '06 #2
mertas said the following on 7/6/2006 3:28 PM:
Use prototype.js to capture events...
Don't. There are better, easier, more reliable ways to do it.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Temporarily at: http://members.aol.com/_ht_a/hikksnotathome/cljfaq/
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jul 6 '06 #3

Randy Webb wrote:
mertas said the following on 7/6/2006 3:28 PM:
Use prototype.js to capture events...

Don't. There are better, easier, more reliable ways to do it.
Ok... = )
Then try this one:
http://www.quirksmode.org/js/introevents.html

Jul 6 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Ramon M. Felciano | last post by:
Helo all -- I'm trying to gain a deeper understand for what type of semi-declarative programming can be done through XML and XPath/XSLT. I'm looking at graph processing problems as a testbed for...
9
by: Jay Donnell | last post by:
I have a function that is a few thousand lines of code (I didn't write it) and I want to capture the output and save it as a variable. This is very easy to do in php. It would look something like...
13
by: Stumped and Confused | last post by:
Hello, I really, really, need some help here - I've spent hours trying to find a solution. In a nutshell, I'm trying to have a user input a value in form's textfield. The value should then be...
17
by: compassSoftware | last post by:
Hi, I have two horizontal frames, one on top of the other. The top frame is an image map of a street with property boundary's on it. The bottom frame is a table with each row of the table...
5
by: elsenraat_76 | last post by:
Hello! I was wondering if someone could help me out with a problem I'm having? I'm trying to input a javascript value into an anchor tag (from a function), but don't have an event to call the...
4
by: Peter Jaffe | last post by:
I've seen a few posts on this topic, but still haven't found a clean solution. Anyone have other suggestions or feel that one of the options I highlight below is the way to go? The Problem...
8
by: Jeff Higgins | last post by:
Hi, In the variable "anchor" I would like to, (I think), use the value of the variable "text" in the predicate of the select expression. Is this possible? Is there a better way of doing...
9
by: Hirru | last post by:
Hi................., i want to capture event from vb dll file in javascript,actually i can already access all the function of that dll from javascript but i don know how to capture event raised by...
13
by: Jim Langston | last post by:
I had asked this in comp.lang.c++ with out any answers that would actually work, so I'm hoping someone here may know a way. I am calling C library functions that want to output to stdout. I need...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.