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

Subject: RE: RE: [xsl] Need to use generate-id() or other method?
From: "Kathy Burke" <Kathy_Burke@xxxxxxxxx>
Date: Thu, 24 Apr 2003 11:57:33 -0400
This does seem to be easier than what I was thinking!

Although the <step> elements don't have an assigned id attribute, I use
xsl:number when I build the table and they get numbered 1., 1.1, 1.1.1, etc.
Could I somehow create this attribute as part of my xsl:number
template...then create the StartTime, EndTime attributes as well?

Furthermore, I also shouldn't have the StartTime, EndTime attributes defined
for the <step> element in my DTD (EMPTY), since I'm creating them at
run-time, yes?

Thank you for such a clear explanation...

Kathy


-----Original Message-----
From: cknell@xxxxxxxxxx [mailto:cknell@xxxxxxxxxx]
Sent: Thursday, April 24, 2003 12:32 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE: RE: [xsl] 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



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


Current Thread