[xsl] general problem with variables and with attribute-sets

Subject: [xsl] general problem with variables and with attribute-sets
From: "Sebastian Fey" <fey@xxxxxxxxxxx>
Date: Fri, 5 Mar 2004 13:40:16 +0100
hi,

i got the following problem:
in the template "formal.object.heading" (see below) i need to assign an attribute-set (either formal.title.properties_AFTER or formal.title.properties_BEFORE) to <fo:block> depending on the value of param $placement (is either 'after' or 'before'). 

i tried several things:

- create a new attribute-set in a choose-clause before the fo:block element but attribute-set may only be declared top-level.
- assing an attribute-set to an xsl:attribute element in the choose-clause following the fo:block (attribute doesnt accept attribute-sets)
- create a variable that contains the name of the right attribute-set, and use this var instead of the qnames. (see below)
(- if i set the <fo:block> into the choose-clause if got no more wellformed xml...)

sure there is a simple way to do this, but id also like some hints or links about usage of variables in XSL.
(btw ive also used {} to wrap the vars, i remember something about {var} but i dont know what use it is)



<xsl:template name="formal.object.heading">
	<xsl:param name="object" select="."/>
	<xsl:param name="placement" select="'before'"/>

	<!-- this element gets the attrset -->
	<fo:block  xsl:use-attribute-sets='formal.title.properties'>
	
	<!--doesnt work cause use-attr-sets expects '..'-->
	<!--<fo:block xsl:use-attribute-sets=string($depends_on.placement)>-->
	
	<!--doesnt work cause the var $placement is treated as string (do i concat strings with '+'? )-->
	<!--<fo:block xsl:use-attribute-sets='formal.title.properties formal.title.spacing_' + $placement>-->
	

	<xsl:choose>
		<xsl:when test="$placement = 'before'">
			<xsl:attribute name="keep-with-next.within-column">always</xsl:attribute>
		</xsl:when>
		<xsl:otherwise>
			<xsl:attribute name="keep-with-previous.within-column">always</xsl:attribute>
		</xsl:otherwise>
	</xsl:choose>

....


thx,

Sebastian

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


Current Thread