Subject: RE: xsl:attribute -- is this doing what I hope?
From: Américo Albuquerque <aalbuquerque@xxxxxxxxxxxxxxxx>
Date: Mon, 28 Apr 2003 20:16:48 +0100
|
Hi
> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of
> Kathy Burke
> Sent: Monday, April 28, 2003 7:49 PM
> To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'
> Subject: xsl:attribute -- is this doing what I hope?
That depends on what is you want to do
>
>
>
> I have a <step> element with a "timer" attribute. If the
> @timer = yes, I want to create 2 additional attributes for
> the <step>. Please tell me where I'm going wrong...again.
>
> Thanks...again.
>
> Kathy
>
>
> <xsl:template match="@timer">
> <xsl:if test=".='yes'">
> <xsl:attribute name="Start"></xsl:attribute>
> <input type="button" value="Start"></input>
This will create an empty attribute named 'Start' and add a child element
<input .../>
> <xsl:attribute name="Finish"></xsl:attribute>
This will not work because you have already create a child element. You
can't create attributes after creating child nodes (elements, text,
comments,etc). You'll have to create the attributes before
> <input type="button" value="Finish"></input>
This will add a second <input .../> child element
> </xsl:if>
> </xsl:template>
>
If you have something like:
<somenode timer="yes"/>
After applying that template you'll end with:
<somenode start="">
<input type="button" value="Start"/>
<input type="button" value="Finish"/>
</somenode>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|