[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

general problem with variables and with attribute-sets

Subject: general problem with variables and with attribute-sets
From: "Sebastian Fey" <fey@xxxxxxxxxxx>
Date: Fri, 5 Mar 2004 13:40:16 +0100
xsl use attribute sets variable
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.