XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 7th, 2004, 11:51 AM
eflanigan eflanigan is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 5 eflanigan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
XML and Javascript Variables

I have an XSL file that displays the info from my XML document. In the XSL i have some Javascript code that takes a variable out of the URL and saves it to a variable airportCode.

Is there anyway to assign the javascript variable airportCode fo the XSL paramter airportID? Thanks!

- Eric

-------------------------------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xslaram name="airportID"/>

<head>
<script language="Javascript">
twdlength = window.location.search.length
urlData = window.location.search.substring(13,twdlength);
airportCode = "'"+ urlData + "'";

document.write("Airport Code = " + airportCode);
</script>
</head>


<html>
<body>

<p></p>
Airport List
<xsl:for-each select="airportinfo/airport[code=$airportID]">
<br>Name: <xsl:value-of select="name"/></br>
<br>Ticket Counter Opens: <xsl:value-of select="ticketopen"/></br>
</xsl:for-each>


</body>
</html>
</xsl:template>
</xsl:stylesheet>

Reply With Quote
  #2  
Old June 17th, 2004, 08:13 AM
kid23 kid23 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 62 kid23 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
From what I see, this isn't possible, I wanted to the same kind of thing a few weeks ago. Here's what I found.

You know that XML + XSL = HTML right ?
This means that when you run your XML file, your browser uses the XSL to perform a transformation into HTML.

What you are trying to do is to get a value that will be available AFTER the transformation, and use it BEFORE the transformation.

This is simply not possible.

What I was trying to do was to save a cookie from a page, and retrieve it in another page using the onload method of the BODY tag, the thing is that OnLoad is called AFTER the transformation, and I needed it BEFORE -> impossible.

Sorry for the bad news

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > XML and Javascript Variables


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT