Hi, Snippets are in fine. Hope this will help you
Pascal SANCHO > -----Message d'origine----- > De : Richard Mixon (qwest) [mailto:[EMAIL PROTECTED] > Envoy� : lundi 9 mai 2005 14:45 > � : [email protected] > Objet : RE: Specifying styles or attribute sets in an FO document > > Pascal Sancho wrote: > > Hi, > > For this purpose, I use xsl:attributes-set elements in a > separate xslt > > file, referenced through a xsl:include element. > > I just need to add a xsl:use-attribute-sets when needed (do > not forget > > the xsl namespace when you use this attribute in a non-xsl element, > > such as a fo:block) This works fine. > > > > Pascal SANCHO > > Pascal, > That sounds like it would do the trick. Can you point me to > an example that shows how to do this somewhere? > Thank you - Richard > Here is an example of a couple of XSL: - the 1st one is called by your engine; - the 2nd one is called by the 1st xsl. <?xml version='1.0'?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format"> <xsl:include href="styles-fo.xsl"/> <!-- root element ====================================================== --> <xsl:template match="/"> <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> <fo:layout-master-set> <xsl:call-template name="masters"/> </fo:layout-master-set> <fo:page-sequence master-reference="default"> <!-- you can make some call-template here to fill-in static regions --> <fo:flow flow-name="xsl-region-body"> <fo:block xsl:use-attribute-sets="simple_block">check</fo:block> </fo:flow> </fo:page-sequence> </fo:root> </xsl:template> <!-- masters ============================================================= --> <xsl:template name="masters"> <!-- all attributes can be defined in other styles-fo.xsl , using attribute-set--> <fo:simple-page-master master-name="default" xsl:use-attribute-sets="master"> <fo:region-body xsl:use-attribute-sets="masterBody"/> <fo:region-before xsl:use-attribute-sets="masterBefore"/> <fo:region-after xsl:use-attribute-sets="masterAfter"/> <fo:region-start xsl:use-attribute-sets="masterStart"/> <fo:region-end xsl:use-attribute-sets="masterEnd"/> </fo:simple-page-master> </xsl:template> </xsl:stylesheet> <!-- here follows the xsl named "styles-fo.xsl" <?xml version='1.0'?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format"> <!-- masters ============================================================= --> <xsl:template name="masters"> <!-- all attributes can be defined in other styles-fo.xsl , using attribute-set--> <fo:simple-page-master master-name="default" xsl:use-attribute-sets="master"> <fo:region-body xsl:use-attribute-sets="masterBody"/> <fo:region-before xsl:use-attribute-sets="masterBefore"/> <fo:region-after xsl:use-attribute-sets="masterAfter"/> <fo:region-start xsl:use-attribute-sets="masterStart"/> <fo:region-end xsl:use-attribute-sets="masterEnd"/> </fo:simple-page-master> </xsl:template> <!-- page master ========================================================= --> <xsl:attribute-set name="master"> <xsl:attribute name="page-height">297mm</xsl:attribute> <xsl:attribute name="page-width">210mm</xsl:attribute> <xsl:attribute name="margin-top">10mm</xsl:attribute> <xsl:attribute name="margin-bottom">10mm</xsl:attribute> <xsl:attribute name="margin-left">10mm</xsl:attribute> <xsl:attribute name="margin-right">10mm</xsl:attribute> </xsl:attribute-set> <xsl:attribute-set name="masterBody"> <xsl:attribute name="margin-top">65mm</xsl:attribute> <xsl:attribute name="margin-bottom">20mm</xsl:attribute> <xsl:attribute name="margin-left">10mm</xsl:attribute> <xsl:attribute name="margin-right">0mm</xsl:attribute> </xsl:attribute-set> <xsl:attribute-set name="masterBefore"> <xsl:attribute name="extent">65mm</xsl:attribute> </xsl:attribute-set> <xsl:attribute-set name="masterAfter"> <xsl:attribute name="extent">15mm</xsl:attribute> </xsl:attribute-set> <xsl:attribute-set name="masterStart"> <xsl:attribute name="extent">0mm</xsl:attribute> </xsl:attribute-set> <xsl:attribute-set name="masterEnd"> <xsl:attribute name="extent">0mm</xsl:attribute> </xsl:attribute-set> <!-- boxes ============================================================== --> <xsl:attribute-set name="simple_block_1"> <!-- note that you can add an use-attribute-sets attribute to this attribute-set --> <xsl:attribute name="font-size">11pt</xsl:attribute> <xsl:attribute name="font-family">sans-serif</xsl:attribute> <xsl:attribute name="space-after">1.5mm</xsl:attribute> </xsl:attribute-set> <xsl:template name="simple_block_2"> <!-- this is an alternative to attribute-set, when formatting depends on context --> <xsl:attribute name="font-size">11pt</xsl:attribute> <xsl:attribute name="font-family">sans-serif</xsl:attribute> <xsl:if test="following-sibling::*"> <xsl:attribute name="space-after">1.5mm</xsl:attribute> </xsl:if> </xsl:template> </xsl:stylesheet> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
