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

Re: Conversion from xsl to xsl:fo

Subject: Re: Conversion from xsl to xsl:fo
From: Max Froumentin <mf@xxxxxx>
Date: Wed, 24 Oct 2001 18:08:24 +0200
xsl fo ul
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

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.