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

RE: RE: Need to use generate-id() or other method?

Subject: RE: RE: Need to use generate-id() or other method?
From: cknell@xxxxxxxxxx
Date: Thu, 24 Apr 2003 11:32:29 -0500
RE: RE:  Need to use generate-id() or other method?
> -----Original Message-----
> From:     "Kathy Burke" <Kathy_Burke@xxxxxxxxx>
> 
> how would I then refer to the @StartTime
> and @EndTime for any given step not knowing what the generated id
> actually is?
> 

I think you are making this more complicated than it has to be. I wouldn't recommend generate-id()here. Would it be too big an assumption to postulate that each step is known when you do the XSL transformation? That is to say, that the whole process consists of a set of known steps.

If that is true, you can add an "id" attribute for each start and stop button when you do the transformation. Say that step one is "Run to the corner and back" and that your XSL transform produces a button to be clicked when the user dashes away from the keyboard and a second button to be clicked when he or she gets back from the corner.

Further, let's say that your XML element which represents the "Run to the corner and back" step looks like this:

<step id="step-1">Run to the corner and back</step>

Your template would be along these lines:

<xsl:template match="step">
  <input type="button" value="Start" onclick="StopWatch()">
    <xsl:attribute name="id">start-<xsl:value-of select="@id" /></xsl:attribute>
  </input>
  <input type="button" value="Stop" onclick="StopWatch()">
    <xsl:attribute name="id">stop-<xsl:value-of select="@id" /></xsl:attribute>
  </input>
</xsl:template>

In your output you will now have two input elements with id attributes of "start-step-1" and "stop-step-1". In your StopWatch() function, you get the value of event.srcElement.getAttribute("id") and you know which button click raised the event, you then access your timer function to get the current time, and you have the identity of the step and the start time or the stop time, depending on which button was clicked.
-- 
Charles Knell
cknell@xxxxxxxxxx - email


 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.