[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
RE: [xsl] Contents of a
RE: [xsl] Contents of a into an AVT?
Subject: RE: [xsl] Contents of a <div> into an AVT?
From: Américo Albuquerque <melinor@xxxxxxx>
Date: Thu, 7 Aug 2003 01:13:01 +0100
Hi.
> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of
> Kathy Burke
> Sent: Wednesday, August 06, 2003 7:14 PM
> To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'
> Subject: RE: [xsl] Contents of a <div> into an AVT?
>
>
> Sorry, I didn't provide that info. For this xml element:
>
> <step>This is the first step.</step>
>
>
> My template does the following:
>
> (1) Creates an html table structure.
>
> (2) In the first column, creates a button with an onclick
> event (which requires use of variables to pass querystring).
>
> (3) Second column, apply xsl:number to the <step> which gives me:
> 1. This is the first step.
>
> That onclick event for each <step>'s button needs the two
> variables ('the number', 'the text of the step'). I capture
> the 2nd var using {.}. but can't figure out how to get the
> "number" (1.2, 1.3, etc.).
>
> ***********************
>
> If I may, here is the template for the step...the entire xsl
> is rather long.
>
> <xsl:template match="step">
> <table>
> <tr>
> <td align="center" valign="middle">
>
> <input type="button" value="Anomaly"
> onclick="Javascript:Anomaly('{id}','{.}')"></input>
>
> </td>
> <td>
> <xsl:variable name="id">
>
> <xsl:number level="multiple" count="step" format="1.1"/>
> </xsl:variable>
>
> <div id="Step_{$id}">
> <xsl:value-of select="$id"/>
> </div>
This is a mixed issue, half javascript half xslt :)
First the javascript part:
If you have you id=Step_1.2, javascript will treat this as property '2' of
object 'Step_1'. so you'll have to change your id definition
The xslt part:
You define your <input> in the same way you define your <div>
<input .... Onclick="Javascript:Anomaly('{$id}','{.}')">
For this to work the definition of the variable id must be the first chilf
of <xsl:template>
So you'll need to have something like:
<xsl:template match="step">
<xsl:variable name="id"><xsl:number level="multiple" count="step"
format="1.1"/></xsl:variable>
<table>
<tr>
<td align="center" valign="middle">
<input type="button" value="Anomaly"
onclick="Javascript:Anomaly('{$id}','{.}')"></input>
</td>
<td>
<div id="Step_{$id}">
<xsl:value-of select="$id"/>
</div>
<xsl:apply-templates select="step"/>
</td>
</tr>
</table>
</xsl:template>
For the id I would use generate-id() instead, like:
<xsl:template match="step">
<table>
<tr>
<td align="center" valign="middle">
<input type="button" value="Anomaly"
onclick="Javascript:Anomaly('{generate-id()}','{.}')"></input>
</td>
<td>
<div id="{generate-id()}">
<xsl:number level="multiple" count="step" format="1.1"/>
</div>
<xsl:apply-templates select="step"/>
</td>
</tr>
</table>
</xsl:template>
(...)
Hope this helps you
Regards,
Americo Albuquerque
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread
- [xsl] Contents of a <div> into an AVT?
- Kathy Burke - Wed, 6 Aug 2003 12:06:38 -0400
- Marty McKeever - Wed, 6 Aug 2003 13:58:18 -0400
- <Possible follow-ups>
- cknell - Wed, 06 Aug 2003 13:48:05 -0400
- Kathy Burke - Wed, 6 Aug 2003 14:13:57 -0400
- Américo Albuquerque - Thu, 7 Aug 2003 01:13:01 +0100 <=
- Kathy Burke - Wed, 6 Aug 2003 14:19:11 -0400
- David Carlisle - Thu, 7 Aug 2003 22:09:30 +0100
- Martinez, Brian - Wed, 6 Aug 2003 12:41:47 -0600
- cknell - Wed, 06 Aug 2003 14:43:27 -0400
<- Previous Index Next ->
RE: [xsl] Contents of a <div> into , Kathy Burke
Thread
RE: [xsl] Contents of a <div> into , Kathy Burke
RE: [xsl] SQL SELECT statement in X, Américo Albuquerque
Date
Re: AW: AW: [xsl] Using key() from , Peter Flynn
Month
Subject: RE: [xsl] Contents of a <div> into an AVT? From: Américo Albuquerque <melinor@xxxxxxx> Date: Thu, 7 Aug 2003 01:13:01 +0100 |
Hi. > -----Original Message----- > From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx > [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of > Kathy Burke > Sent: Wednesday, August 06, 2003 7:14 PM > To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx' > Subject: RE: [xsl] Contents of a <div> into an AVT? > > > Sorry, I didn't provide that info. For this xml element: > > <step>This is the first step.</step> > > > My template does the following: > > (1) Creates an html table structure. > > (2) In the first column, creates a button with an onclick > event (which requires use of variables to pass querystring). > > (3) Second column, apply xsl:number to the <step> which gives me: > 1. This is the first step. > > That onclick event for each <step>'s button needs the two > variables ('the number', 'the text of the step'). I capture > the 2nd var using {.}. but can't figure out how to get the > "number" (1.2, 1.3, etc.). > > *********************** > > If I may, here is the template for the step...the entire xsl > is rather long. > > <xsl:template match="step"> > <table> > <tr> > <td align="center" valign="middle"> > > <input type="button" value="Anomaly" > onclick="Javascript:Anomaly('{id}','{.}')"></input> > > </td> > <td> > <xsl:variable name="id"> > > <xsl:number level="multiple" count="step" format="1.1"/> > </xsl:variable> > > <div id="Step_{$id}"> > <xsl:value-of select="$id"/> > </div> This is a mixed issue, half javascript half xslt :) First the javascript part: If you have you id=Step_1.2, javascript will treat this as property '2' of object 'Step_1'. so you'll have to change your id definition The xslt part: You define your <input> in the same way you define your <div> <input .... Onclick="Javascript:Anomaly('{$id}','{.}')"> For this to work the definition of the variable id must be the first chilf of <xsl:template> So you'll need to have something like: <xsl:template match="step"> <xsl:variable name="id"><xsl:number level="multiple" count="step" format="1.1"/></xsl:variable> <table> <tr> <td align="center" valign="middle"> <input type="button" value="Anomaly" onclick="Javascript:Anomaly('{$id}','{.}')"></input> </td> <td> <div id="Step_{$id}"> <xsl:value-of select="$id"/> </div> <xsl:apply-templates select="step"/> </td> </tr> </table> </xsl:template> For the id I would use generate-id() instead, like: <xsl:template match="step"> <table> <tr> <td align="center" valign="middle"> <input type="button" value="Anomaly" onclick="Javascript:Anomaly('{generate-id()}','{.}')"></input> </td> <td> <div id="{generate-id()}"> <xsl:number level="multiple" count="step" format="1.1"/> </div> <xsl:apply-templates select="step"/> </td> </tr> </table> </xsl:template> (...) Hope this helps you Regards, Americo Albuquerque XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Contents of a <div> into , Kathy Burke | Thread | RE: [xsl] Contents of a <div> into , Kathy Burke |
RE: [xsl] SQL SELECT statement in X, Américo Albuquerque | Date | Re: AW: AW: [xsl] Using key() from , Peter Flynn |
Month |
Products
Features
Resources
Support
Oxygen XML on Facebook
Follow
Oxygen XML on Twitter
Oxygen XML Web Feed
Oxygen XML
Blog
Oxygen XML Youtube Channel
© 2002-2022 SyncRO Soft SRL. All rights reserved.
This website was created & generated with <oXygen/>®XML Editor