[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: RE: javascript variable in xsl:variable

Subject: Re: RE: javascript variable in xsl:variable
From: Ken Schulte <kschulte@xxxxxxxxxx>
Date: Fri, 26 Apr 2002 09:13:52 -0400
javascript variable xml
I'm creating a client/server application, where the xml is 
created on the server as well as the transformation. However, I 
would like the user inteface scripts to take place on the 
client side. So, the reason for trying to place a javascript 
variable inside an xsl:variable, it would give me the ability 
to create generic functions which would work as dynamically as 
possible. Also, I've got some restictions: the xml file is 
created in memory and is not saved to a file, so I don't know 
of a way to use the DOM in Javascipt. 

Dion, I don't believe your style recomendation would work
since <xsl:variable name="varID">strID</xsl:variable> would be 
placed infront the function test, where strID is passed in.
I need the value from strID inorder to do some xml checks.

In my xml I'm passing  in an onclick attribute the name of the 
function "test(this)", when the html is created via 
tranformation. this onclick event is represented in an radio 
button. If the user choses this radio button then I need to 
disable some other checkboxs, which only exist in the html.

I hope I haven't confused everybody to badly.

So, my objective is to have an xml document in memeory that I 
can build an html page via xsl transformation. Then when the 
users cause an event to be executed, I want to be able to read 
xml and perform necessary changes to html. 



________________________________________________
Get your own "800" number
Voicemail, fax, email, and a lot more
http://www.ureach.com/reg/tag


---- On Thu, 25 Apr 2002, Dion Houston (dionh@xxxxxxxxxxxxx) 
wrote:

> To expand the discussion a little bit... what do you intend 
to do with
> this?
> 
> If it's simply to create an HTML version of an XML document, 
then you
> should be perfectly fine.  As a matter of style, I'd write it:
> 
> <xsl:template match="/">
>    <xsl:variable name="varID">strID</xsl:variable>
>    <script language="javascript">
>       function test(strID)
>       {
>          alert('<xsl:value-of select="$varID"/>')
>       }
>    </script>
> </xsl:template>
> 
> To make it more obvious that the variable is associated with 
the XSL
> rather than the script, but either way is correct.
> 
> If you are intending on writing script inside an XSLT script 
(e.g. to
> expand the processing of the script), this approach will not 
work for
> the reasons Theo mentioned.
> 
> HTH!
> 
> Dion
> 
> 
> -----Original Message-----
> From: Brinkman, Theodore 
[mailto:Theodore.Brinkman@xxxxxxxxxxxxxxxxxxxx]
> 
> Sent: Thursday, April 25, 2002 2:20 PM
> To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'
> Subject: RE:  javascript variable in xsl:variable
> 
> For a case like your example, you need to remember that until 
the
> tranformation is finished, the javascript won't actually be 
running, so
> the
> javascript variable won't have any value.
> 
> The XSL generates a node-tree, which is (usually) serialized 
out to text
> and
> sent off to have something else use it, so none of the 
javascript will
> be
> interpreted as anything except the contents of a node-tree 
until it gets
> to
> that something else.
> 
> 	- Theo
> 
> -----Original Message-----
> From: Ken Schulte [mailto:kschulte@xxxxxxxxxx]
> Sent: Thursday, April 25, 2002 4:56 PM
> To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  javascript variable in xsl:variable
> 
> 
> Does anybody know if it is possible to add a javascript 
variable
> into an xsl:variable?
> 
> example:
> <xsl:template match="/">
>    <script language="javascript">
>       function test(strID)
>       {
>          <xsl:variable name="varID">
>             strID
>          </xsl:variable>
>          alert('<xsl:value-of select="$varID"/>
>       }
>    </script>
> </xsl:template>
> 
> Thank you much,
> Ken
> 
> ________________________________________________
> Get your own "800" number
> Voicemail, fax, email, and a lot more
> http://www.ureach.com/reg/tag
> 
>  XSL-List info and archive:  
http://www.mulberrytech.com/xsl/xsl-list
> 
> 
>  XSL-List info and archive:  
http://www.mulberrytech.com/xsl/xsl-list
> 
> 
>  XSL-List info and archive:  
http://www.mulberrytech.com/xsl/xsl-list
> 
> 
> 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.