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

Re: How to modify xsl:param with javascript

Subject: Re: How to modify xsl:param with javascript
From: Robert Koberg <rob@xxxxxxxxxx>
Date: Mon, 19 Mar 2001 14:54:15 -0800
javascript increment function
Damn my itchy trigger finger...

That should be:
<a href="JavaScript:increment('{$returnedSValue}'>

----- Original Message -----
From: "Robert Koberg" <rob@xxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Monday, March 19, 2001 2:41 PM
Subject: Re:  How to modify xsl:param with javascript


> Yea, sorry, since it is in an attribute you need to put the value in a
> variable first and then put it in the attribute like:
> <xsl:variable name="returnedSValue">
>    <xsl:call-template name="getSValue"/>
> </xsl:variable>
> <a href="JavaScript:increment('{returnedSValue}'>
>
>
> ----- Original Message -----
> From: "Davut Karabay" <dkarabay@xxxxxxxxx>
> To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
> Sent: Monday, March 19, 2001 2:23 PM
> Subject: Re:  How to modify xsl:param with javascript
>
>
> > Hi Robert,
> > Thanks for replies. However, when I do what you are
> > saying then I got the following error message even
> > though I used single quotes.
> >
> > The value of attribute "href" must not contain the '<'
> > character.
> >
> > Also, do you think the following function would work
> > to increment the value?
> >
> > fuction increment(sValue)
> > {
> >     var s =  sValue;
> >     s.value = s.value + 5;
> > }
> >
> > Ragards,
> > Davut Karabay
> >
> >
> > --- Robert Koberg <rob@xxxxxxxxxx> wrote:
> > > The first thing I would do is try to get it to work
> > > in plain html/js. Then
> > > convert that to XSLT.
> > >
> > > If you are including the file then you will not get
> > > a transformation on it
> > > because the include happens when the browser (on the
> > > client) parses the
> > > page.  What I would do is put the 'var s' value as
> > > the parameter that you
> > > send to the function.  So you make the
> > > transformation happen (on the server)
> > > to populate the value as the parameter to send. So
> > > now you have a completely
> > > separate JS function and the generated link with the
> > > value of the
> > > transformation ready to be sent (to the function in
> > > the include) on click of
> > > the link.
> > >
> > > I need some explanation on what you are trying to do
> > > with
> > > document.XSLDocument.selectSingleNode and s.value
> > >
> > > but here is how I would do it:
> > >
> > > fuction increment(sValue)
> > > {
> > >    var s =  sValue;
> > > }
> > >
> > > --------------------------
> > > and the link I don't realy understand what you are
> > > try to do with the XPath
> > > expression but it is way off - also note the single
> > > quote:
> > > <a href="JavaScript:increment('<xsl:call-template
> > > name="getSValue"/>'>
> > >
> > > Then have the getSValue template that returns the
> > > string you need for the
> > > parameter.
> > >
> > > HTH
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > ----- Original Message -----
> > > From: "davut karabay" <dkarabay@xxxxxxxxx>
> > > To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
> > > Sent: Monday, March 12, 2001 11:17 AM
> > > Subject: Re:  How to modify xsl:param with
> > > javascript
> > >
> > >
> > > > Hi,
> > > > I decided to put my javascript function into a
> > > file
> > > > called increment.js like this:
> > > >
> > > > fuction increment()
> > > > {
> > > >   var s =
> > > >
> > >
> >
>
document.XSLDocument.selectSingleNode("/*/xsl:template[@match='/']//xsl:appl
> > >
> > y-templates/xsl:with-param[@name='startIndex']/@select");
> > > >   s.value = s.value + 10;
> > > > }
> > > >
> > > > then I include it like:
> > > >
> > > > <script src="/pxc/increment.js"
> > > > language="JavaScript"></script>
> > > >
> > > > and from <a> tag, I call the function in order to
> > > > increment the xsl parameter startIndex, like this:
> > > >
> > > > <a href="JavaScript:increment()">
> > > >
> > > > It still does not work. Do I need to pass some
> > > > parametes into the function? or return something
> > > from
> > > > there? I am new to JavaScript and any kind of help
> > > is
> > > > greatly appreciated.
> > > > Regards,
> > > > Davut
> > > >
> > > > --- Robert Koberg <rob@xxxxxxxxxx> wrote:
> > > > > in your onclick you have double quotes nested
> > > inside
> > > > > of double quotes. that
> > > > > is a no-no.
> > > > >
> > > > > a better way to handle this is to create a JS
> > > > > function (put in the head with
> > > > > cdata or included) and send the variable info as
> > > > > parameters to the function
> > > > >
> > > > >
> > > > > ----- Original Message -----
> > > > > From: "davut karabay" <dkarabay@xxxxxxxxx>
> > > > > To: <XSL-List@xxxxxxxxxxxxxxxxxxxxxx>
> > > > > Sent: Friday, March 09, 2001 5:06 PM
> > > > > Subject:  How to modify xsl:param with
> > > > > javascript
> > > > >
> > > > >
> > > > > > Hi,
> > > > > > My xml data would probably contain hundreds of
> > > > > device
> > > > > > names in it. I would like to make my xslt
> > > sheet to
> > > > > > process the data 10 at a time. In other words,
> > > > > only
> > > > > > first 10 of the xml data will be displayed in
> > > the
> > > > > > first html page. There will be a "More"
> > > hyperlink
> > > > > at
> > > > > > the bottom of the page and once clicked, next
> > > 10
> > > > > > should be listed so and so forth...
> > > > > >
> > > > > > I define a parameter called startIndex with an
> > > > > initial
> > > > > > value of 0. Then I would like to increase it
> > > by 10
> > > > > > every time the user clicks "More" hyperlink.
> > > When
> > > > > I
> > > > > > display devices, I choose ones whose
> > > position()
> > > > > > greater than startIndex and less than
> > > > > (startIndex+10).
> > > > > >
> > > > > > Here is the related part of my xslt sheet
> > > which
> > > > > would
> > > > > > not be processed for some reason that I don't
> > > > > > understand.
> > > > > >
> > > > > > <xsl:param name="startIndex" select="0"/>
> > > > > > .....
> > > > > > .....
> > > > > >
> > > > > > <xsl:apply-templates select="device[position()
> > > > > > &gt;=$startIndex and position()
> > > > > > &lt;=($startIndex+10)]"/>
> > > > > > .....
> > > > > > .....
> > > > > >
> > > > > > <a href="javascript:void(0);"
> > > > > > onMouseOver="self.status='More';
> > > return(true);"
> > > > > > onClick="var
> > > > > >
> > > > >
> > > >
> > >
> >
s=style.selectSingleNode("/xsl:stylesheet/xsl:param[@name='startIndex']");
> > > > > > s.value=s.value+10; return(false);"
> > > > > > onMouseOut="self.status=''">More</a>
> > > > > > .....
> > > > > > .....
> > > > > >
> > > > > > I can not even see the first page. Here is the
> > > > > message
> > > > > > I got:
> > > > > >
> > > > > > Element type "a" must be followed by either
> > > > > attribute
> > > > > > specifications, ">" or "/>".
> > > > > >
> > > > > > I understand it does not like it within <a>
> > > tag
> > > > > but I
> > > > > > don't know why.
> > > > > > Does anyone have any suggestions on How else I
> > > > > could
> > > > > > write it?
> > > > > >
> > > > > > Regards,
> > > > > > Davut Karabay
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > __________________________________________________
> > > > > > Do You Yahoo!?
> > > > > > Get email at your own domain with Yahoo! Mail.
> > > > > > http://personal.mail.yahoo.com/
> > > > > >
> > > > > >  XSL-List info and archive:
> > > > > http://www.mulberrytech.com/xsl/xsl-list
> > > > > >
> > > > >
> > >
> > === message truncated ===
> >
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Get email at your own domain with Yahoo! Mail.
> > http://personal.mail.yahoo.com/
> >
> >  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.