At 2004-11-13 07:18 -0800, Karl J. Stubsjoen wrote:
Using xsl:attribute (or similar), is there a way to append an attribute to
an existing attribute set?
No. Every time you define an attribute value it will replace any pending
attribute value for the currently open set of specified attributes. I'm
assuming when you say "attribute set" you are speaking of the open set of
specified attributes and not the XSLT "attribute-set" construct.
Example:
<div class="my_div">
<xsl:attribute name="class">big_font</xsl:attribute>
</div>
Desired Output:
<div class="my_div big_font">
</div>
Assuming that your <xsl:attribute/> is embedded in some testing logic
(otherwise you would have explicitly added it), my recommendation would be
to use the attribute instruction for all of the properties with the logic
as follows (note the spacing inside the <xsl:text>):
<div>
<xsl:attribute name="class">
<xsl:text>my_div</xsl:text>
<xsl:if test="$mytest">
<xsl:text> big_font</xsl:text>
</xsl:if>
<xsl:if test="$myothertest">
<xsl:text> other_property</xsl:text>
</xsl:if>
</xsl:attribute>
...
</div>
Since all attributes need to be added before any content, the above should
not be disruptive to the flow of logic you would need if such a thing as an
append existed ... which it does not.
I hope this helps.
.................... Ken
--
World-wide on-site corporate, govt. & user group XML/XSL training.
G. Ken Holman mailto:gkholman(_at_)CraneSoftwrights(_dot_)com
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995)
Male Breast Cancer Awareness http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers: http://www.CraneSoftwrights.com/legal
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--