It can be done. Consider the following stylesheet (which you can test by
applying it to itself):
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="2.0" omit-xml-declaration="no"
indent="yes"/>
<xsl:param name="who"/>
<xsl:attribute-set name="Oscar">
<xsl:attribute name="slob">yes</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="Felix">
<xsl:attribute name="slob">no</xsl:attribute>
</xsl:attribute-set>
<xsl:template match="/">
<bachelor>
<xsl:choose>
<xsl:when test="$who='Oscar'">
<xsl:attribute name="xsl:use-attribute-sets">
<xsl:value-of select="'Oscar'"/>
</xsl:attribute>
</xsl:when>
<xsl:when test="$who='Felix'">
<xsl:attribute name="xsl:use-attribute-sets">
<xsl:value-of select="'Felix'"/>
</xsl:attribute>
</xsl:when>
</xsl:choose>
</bachelor>
</xsl:template>
</xsl:stylesheet>
I tested that with Xalan Java 2.4.1
It's easier in 2.0 because
<xsl:attribute name="xsl:use-attribute-sets">
<xsl:value-of select="'Oscar'"/>
</xsl:attribute>
can be
<xsl:attribute name="xsl:use-attribute-sets" select="'Oscar'"/>
I tested that with Saxon 8.5.1.
Jay Bryant
Bryant Communication Services
(presently consulting at Synergistic Solution Technologies)
--~------------------------------------------------------------------
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>
--~--