[xsl] Copying Groups of Attributes

Subject: [xsl] Copying Groups of Attributes
From: "Ciaran Byrne" <ciaran.byrne@xxxxxxx>
Date: Mon, 12 Feb 2001 16:27:09 -0800
Hi all,
	Is any one aware of a way where I can group attributes in
my XSL in a similar fashion to the way they might be grouped in
a DTD.

Taking an example from HTML Spec..

<!ELEMENT P - 0 (%inline;) *
<!ATTLIST P
%attrs; 	-- %coreattrs,%il8n,%events --
>

where %coreattrs is..

<!ENTITY %coreattrs
"id	ID		#IMPLIED
class	CDATA		#IMPLIED
style	%Stylesheet;#IMPLIED
title	%Text;	#IMPLIED
>

and so on..

(At the moment) In my XSL if I want to copy across attributes only if they
exist I have
the following template:

<xsl:template match="p">
	<p>
		<xsl:if test="@id">
			<xsl:attribute name="align"><xsl:value-of select="@id"/></xsl:attribute>
		</xsl:if>
		<xsl:if test="@class">
			<xsl:attribute name="align"><xsl:value-of
select="@class"/></xsl:attribute>
		</xsl:if>
		....... and so on for the rest of the attributes
	</p>
</xsl:template>

Is there anyway for me to reduce this overhead ? I'm aware of attribute-sets
by my understanding
is that they are only a "textual macro". Is this correct ?

Thanks,
Ciaran.



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread