![]() |
![]() | ![]() | ![]() | Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries [Thread Prev] >Thread Next - Re: invoke javascript function in xslt before parsing xml? invoke javascript function in xslt before parsing xml?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
| ![]() | ![]() | ![]() |
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | |||||
|
