Subject: Re: [xsl] import-apply-param etc? From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx> Date: Mon, 30 Apr 2001 09:35:41 +0100 |
Hi Koray, > So I figured out, I "import" this standard(first) xsl to a second > xsl on which I define color and font attributes and so forth. It sounds as though you want to do the processing in two steps - first create the (X)HTML, and then add formatting information to that (X)HTML. It's fairly difficult to split those up into two steps in one stylesheet (although it's fairly easy to do it all in one step in one stylesheet). I'd recommend one of the following approaches: 1. forget about adding style information to the HTML with an XSLT stylesheet - instead, use CSS to define the style of the HTML that you're producing. 2. add the formatting information at the same time as you generate the HTML. In your example, where you want to add a border attribute from the source XML to the HTML that you're producing, you could do: <xsl:template match="Table"> <br/> <xsl:value-of select="No"/><br/> <xsl:value-of select="Name"/><br/> <!-- added border attribute --> <table border="{@border}"> <xsl:apply-templates select="ColumnHeaders"/> <xsl:apply-templates select="Rows"/> </table> <br/> </xsl:template> 3. import your generating stylesheet to the formatting one, and have templates that capture the result of applying imports to the node, and process the result of that (converting first to a node set with exsl:node-set() or similar). 4. perform the transformation in two steps with two separate stylesheets - first run the stylesheet to generate the XHTML, and then run another stylesheet to add the formatting. This is made more complicated by the fact that you use the same source XML in each. The latter two approaches are in fact so complicated that I would think long and hard before I used them in this situation. If you *really* want to use one of them, we can try to work it out, but the former two approaches are so much easier. Sorry not to be more help, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] import-apply-param etc?, Koray Berk | Thread | [xsl] How do I do an If sort of thi, Tim Watts |
RE: [xsl] How do I do an If sort of, Michael Kay | Date | [xsl] Combined PERL/XSLT genetic al, Juan Julian Merelo G |
Month |