Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


invoke javascript function in xslt before parsing xml?

From: "gary.comstock@-----.---" <----.--------@-----.--->
To: NULL
Date: 2/13/2007 12:41:00 PM

I have an xml document that contains elements for a users Microsoft
Exchange free/busy schedule.  Each element denotes a 15 minute
interval and I need to display 8 hours or about 32 elements in html.

Since there are 4 time zones in the US I thought I'd use javascript to
determine which time zone the user is in which will tell me which xml
element I should start processing in my xslt.  Assume element 1
(<xsl:value-of select="Field[@name='1']"/>) is 6:00 am Pacific time or
8:00 am Central standard time.  If in Pacific standard time I need to
start at element 1 or but if the browser client is in the Central time
zone which is 2 hours later (2 hours * 4 elements per hour) I need to
use create my xslt logic to start at element 8.

results.xml:
-------------------------------------------------------------
<MODULE_RESULT>
	<Field name="1">Busy</Field>
	<Field name="2">Busy</Field>
	<Field name="3">Busy</Field>
	<Field name="4">Busy</Field>
	<Field name="5">Free</Field>
	<Field name="6">Free</Field>
	<Field name="7">Free</Field>
	<Field name="8">Free</Field>
	<Field name="9">Free</Field>
	<Field name="10">Free</Field>
	<Field name="11">Free</Field>
	<Field name="12">Free</Field>
	<Field name="13">Free</Field>
	<Field name="14">Free</Field>
	<Field name="100">Free</Field>


When trying to run the javascript I'm getting an error "Cannot find a
matching 0-argument funtion named {http://myserver/web_services/
employee}GetClientUTC().  I'm sure this is a namespace issue but I'm
not sure how to resolve it.

xslt stylesheet
---------------------------------------------------------------------------------------------------
<?xml version='1.0' encoding='UTF-8'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
				xmlns:msxsl="urn:schemas-microsoft-com:xslt"
				xmlns:user="http://myserver/web_services/employee"
				version="1.0">
<xsl:output method="html" encoding="UTF-8"/>
<xsl:template match="OneBoxResults">
<xsl:variable name="SearchRequeryUrl">http://goo2-mid-tx-001/search?
q=</xsl:variable>
<xsl:variable name="keyword"><xsl:value-of select="title/keyword"/></
xsl:variable>
<xsl:variable name="image"><xsl:value-of select="IMAGE_SOURCE"/></
xsl:variable>
<script src="http://gsa2-mid-tx-001/modules/misc/script/gob.js"
type="text/javascript"/>
<msxsl:script language="javascript" implements-prefix="user">
<![CDATA[
function GetClientUTC()
{
	var now = new Date();
	var offset = (now.getTimezoneOffset() / 60)*-1;
	//document.forms.emp.tz.value = offset;
	return offset
}
]]>
</msxsl:script>

<link href="http://gsa2-mid-tx-001/modules/misc/style/directory.css"
rel="stylesheet" type="text/css"/>
<body>
	<xsl:variable name="gmt" select="user:GetClientUTC()" />
	<xsl:value-of select="$gmt"/>
</body>

Is there a better way to get this done that attempting to use
javascript?

Thanks for any help,
g



transparent
Print
Mail
Digg
delicious
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