Subject: Re: [xsl] Conversion from xsl to xsl:fo From: Max Froumentin <mf@xxxxxx> Date: Wed, 24 Oct 2001 18:08:24 +0200 |
You wrote: > There are (at least) two ways to get from > "(1): a stylesheet producing X" and "(2): a styleheet converting X to Y" > to "(3): a stylesheet producing Y" > > plan a) > write a stylesheet that takes (1) as input and modifies all the > templates so that where they use constructions from the language X > the result is a template using constructions from language Y. IIRC what stopped me doing this was this particular case: Suppose the input DTD of (1) has elements <foo> and <bar> that are like xhtml's ul and li (a <foo> contains <bar>s and a <bar> can contain <foo>s) (1) has <xsl:template match="foo"><ul><xsl:apply-templates/></ul></xsl:template> <xsl:template match="bar"><li><xsl:apply-templates/></li></xsl:template> (2) converts XHTML to FO <template match="ul"> <fo:list-block><apply-templates/></fo:list-block> </template> <template match="li"> <fo:list-item> <fo:list-item-label> <choose> <when test="count(ancestor::ul)=1">-</when> <when test="count(ancestor::ul)=2">*</when> </choose> </fo:list-item-label> <fo:list-item-body><apply-templates/></fo:list-item-body> </fo:list-item> </template> How do I rewrite template 2 of (1) if I don't know that <bar>s can descend from <foo>s. When I rewrite <li> I guess I can go look for all the templates that produce <ul> in (1), find out that it is produced by <foo> and write a <choose> appropriately, but I don't think you can infer it on more complex cases (where <li> are produced in more than one template). > plan b) > is to use a xx:node-set extension and just write stylesheet (3) like so: Ah yes. I was young at the time and thought I could do without extensions. This is equivalent to running (1) and (2) sequentially, which is what I did. Max. XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Conversion from xsl to xs, David Carlisle | Thread | Re: [xsl] Conversion from xsl to xs, David Carlisle |
Re: [xsl] Conversion from xsl to xs, David Carlisle | Date | Re: [xsl] ***********Transformation, David Carlisle |
Month |