Re: [xsl] Can one Use JavaScript to update XSL:Variables

Subject: Re: [xsl] Can one Use JavaScript to update XSL:Variables
From: Marcus Andersson <marcus@xxxxxxxxxx>
Date: Thu, 29 Jul 2004 09:48:41 +0200
You can use <xsl:param name="page"/> to send values into a transform from "outside".

You can do:

<xsl:stylesheet ...>
  <!-- 1 is the default here if you don't pass the param-->
  <xsl:param name="page" select="1"/>


And then you use the param as if it were a <xsl:variable/> and it's global.

How you pass the param into the stylesheet depends on the XSLT engines API you are using but if you're doing this client side I would recommend to look into Sarissa (


dave frette wrote:

Michael & Vasu -

Thanks, I finally found documentation that said the
same.  I just now got the emails, sorry for the
delayed response.

OK.  I am building my own photogallery.  As a side,
yes, I know it's all been done before.  But hey, I
want it my way!  Besides, I am learning.

Requirements (wishes) a) 1 datafile per gallery called galleryname.xml(which could contain 200 images or more if desired). b) only 15 (3 rows x 5 columns) thumbs shown on the index at a time. c) user sees a choice of "Pages 1 2 3 4 5" and so on d) when s/he presses the link for page 2, it shows the next 15 thumbs, or presses 3 it shows thumbs 31-45 e) when clicked on a thumb, then browser directed to image.xml w/ image.xsl w/ image.css. I only want 1 image.xml file (i may have 50 galleries, i only want 1 image.xml file) which can dynamically (client-side)figure which image to display, perhaps based on URL. (I do not want a file with every image i have in it.) f) no popup windows, no flash, prefer not to use DOM either. I'd like to stick to XML/XSLT/JavaScript.

So, in a nutshell, i was hoping my index.xml could
parse the url, update $page, and use-- <xml:for-each select="image[position() > $row * $col *
($page - 1) and position() < $row * $col * $page]">

Thanks for any help and suggestions!

- Dave

--- Michael Kay <mhk@xxxxxxxxx> wrote:

I want to parse the URL of my page and update an

XSL variable.

You can't update XSLT variables.

Now tell us your real problem (to which you thought
the above might be a

Michael Kay

Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!

Current Thread