This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: attribute value replaced with <xsl:attribute/>?
- From: Jarno dot Elovirta at nokia dot com
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Thu, 22 Aug 2002 08:50:12 +0300
- Subject: RE: [xsl] attribute value replaced with <xsl:attribute/>?
- Reply-to: xsl-list at lists dot mulberrytech dot com
Hi,
> <xsl:attribute name="smth"/>
> replaces the hardcoded original "@smth" attribute in an element like
> <el smth="*">
> is it ok? am i safe putting default values into
> <el>
> and when needed replace the value with
> <xsl:if test="">
> <xsl:attribute/>
> </xsl:if>
> or should i put default stuff into
> <xsl:otherwise/>?
> i use xalan and i wonder if this behaviour common to all processors?
Umm... to tell you the truth, I don't quite understand the question, but if you're asking whether you should use xsl:if or xsl:choose to get what you want, that's a matter of taste.
> note that instead of
> <td class="jian" class="sizaki">does it change?</td>
> i get:
> <td class="sizaki">does it change?</td>
Yes, because xsl:attribute replaces the existing attribute. But still, you don't want to get two class attributes, as XML doesn't allow that. Instread try to write your XSLT stylesheet to generate
<td class="jian sizaki">does it change?</td>
which is what you really should want.
Cheers,
Jarno
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list