On Sun, 09 Sep 2001 13:26:59 Malcolm Locke wrote:
Probably, if I understand you correctly, you wan't to use xsl:attribute-set.
<xsl:attribute-set name="font-attrs"> <xsl:attribute name="color">black</xsl:attribute> </xsl:attribute-set>
<xsl:template match="paragraph"> <xsl:element name="font" use-attribute-sets="font-attrs"> xsl:apply-templates/ </xsl:element> </xsl:template>
That sounds exactly what I need, though in my case the stylesheet is converting into XSL formatting objects because I want the output as postscript and PDF. In that case would I say:
<xsl:template match="paragraph"> <xsl:element name="fo:block" use-attribute-sets="font-attrs"> xsl:apply-templates/ </xsl:element> </xsl:template>
in much the same way.
See http://nwalsh.com/docs/tutorials/xsl/xsl/foil63.html for more comprehensive examples.
Ah, thanks for the referene. I had already found chapter 18 of the XML bible on-line and there is the stuff at the W3 web site, but the specs make very heavy reading when you're just starting out so tutorials are just what I need right now.
Having said that, it would probably be better to use div and span elements with different classes and a CSS stylesheet.
For HTML output perhaps. Actually I am intending to have HTML output too - I am just concentrating on the printed output first because that seems like it will be the hardest and I don't want to wate time getting HTML ouput working and then find I can't do the print bit.
In fact, I have already found the first issue that was very nearly a show stopper with print output - FOP will not accept EPS format images and when given a GIF image it omits it from the output when generating Postscript. It does include the GIF image in PDF output but if I use pdf2ps to convert the PDF to postscript it doesn't print on my printer.
I ended up solving this by filtering the postscript output through a perl script which looks at the document structure comments and inserts the EPS image at the correct point.
Anyway, back to the HTML output. The HTML output is to be used on a website which already uses a CSS stylesheet so I will be aiming to translate the XML into well formed HTML that works with that stylesheet so in that way I can use class attributes whenever the usual <h1> etc. isn't quite on the mark.
Thanks for your help. Steve.