xsl:fo in web browsers

Subject: xsl:fo in web browsers
From: Vidar Gundersen <vidarg@xxxxxx>
Date: 10 Sep 1999 10:05:18 +0200
Why not display XML using XSL Formatting Objects in Web browsers?

I have this idea: Any browser with XSL, CSS and HTML 4.0 support can
in principle transform the FO document instance into HTML with inline
CSS.

An example: The template below...

  <xsl:template match="title">
    <fo:block background-color="yellow" border-style="solid"
      font-family="sans-serif" font-size="20pt" font-weight="bold">
      <xsl:apply-templates/>
    </fo:block>
  </xsl:template>

...is displayed with the following HTML:

<div style="background-color: yellow; border-style: solid;
font-family: sans-serif; font-size: 20pt; font-weight: bold; ">Just
testing an idea.</div>

All you need is a mechanism that recognises the "fo" namespace in
the result-tree and applies a new stylesheet to it.

A simple example template for XSL:FO to HTML+CSS transformation:

  <xsl:template match="fo:block">
    <div>
      <xsl:attribute name="style">
	<xsl:for-each select="@*">
	  <xsl:value-of select="name()"/>
	  <xsl:text>: </xsl:text>
	  <xsl:value-of select="."/>
	  <xsl:text>; </xsl:text>
	</xsl:for-each>
      </xsl:attribute>
      <xsl:apply-templates/>
    </div>
  </xsl:template>

BTW: Have anyone made a complete stylesheet
for XSL:FO to CSS or HTML+CSS tranformation?

I can't see any reason not to put this
feature into future Web browsers...

-- 
Vidar Bronken Gundersen


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread