xsl-list
[Top] [All Lists]

Re: [xsl] xsl 2.0?

2013-11-04 04:23:56
Dear Liam Quin,

It is not really technical but social - CSS is more widely used, and it
is easier to find designers who can work in terms of CSS.

It sounds to me that it is hard to judge it to be a rational reason that people 
should  move from XSL-FO to CSS.

I want point out the fact that it will not become the benefit using CSS rather 
than XSL-FO even if it is widely used than XSL-FO. It is the maintenance & 
debugging cost.

Given an last publication A (such as PDF) and there are 500 styles are needed 
to make this publication. If we adopt XSL-FO, these styles are all embed as 
property of XSL formatting objects. 

[Example: DITA authoring snippet]
<!-- This is only a example. DITA has <b>,<u>,<i> elements. -->
<p outputclass="b u i">
  ...
</p>

[Converted XSL-FO]
<!-- font-family & font size are the style of "p". The others are obtained from 
@outputclass -->
<fo:block font-family="Arial" font-size="10pt" font-weight="bold" 
text-decoration="underline" font-style="italic">
  ...
</fo:block>

In the case of CSS all of the styles are written in the another file like 
following.

[Converted XHTML]
<link rel="stylesheet" type="text/css" media="print" href="style_print.css" />

<div class="p b u i">
  ...
</div>

[style_print.css]
div.p{font-family:Arial;font-size=10pt;}
*.b{font-weight:bold;}
*.u{text-decoration:underline;}
*.i{font-style:italic;}

If we find unexpected formatting result in the PDF, we can examine XSL-FO file 
formatting objects and properties for it.

However in the case of CSS case we must examine all of the CSS styelsheet file 
attached and find the selector that are applied to the relevant formatting 
result. 

Next example shows more complex case:

[Example: DITA authoring snippet]
<!-- We want to apply color red for first paragraph. Also we want apply blue 
for last paragraph. -->
<body>
  <p>Paragraph 1</p>
  <p>Paragraph 2</p>
  <p>Paragraph 3</p>
</body>

[XSL-FO stylehesst]
<xsl:template match="body">
  <fo:block use-attribute-sets="body" >
    <xsl:apply-templates select="*"/>
  </div>
</xsl:templates>
<xsl:template match="p">
  <fo:block use-attribute-sets="p">
    <xsl:choose>
      <xsl:when test="position() eq 1">
        <xsl:attribute name="color" select="'red'"/>
      </xsl:when>
      <xsl:when test="position() eq last()">
        <xsl:attribute name="color" select="'blue'"/>
      </xsl:when>
    </xsl:choose>
    <xsl:apply-templates/>
  </div>
</xsl:template>

[Result XSL-FO]
<fo:block ...>
  <fo:block font-family="Arial" font-size="10pt" color="red">Paragraph 
1</fo:block>
  <fo:block font-family="Arial" font-size="10pt">Paragraph 2</fo:block>
  <fo:block font-family="Arial" font-size="10pt" color="blue">Paragraph 
3</fo:block>
</fo:block>

[CSS stylehesst]
<xsl:template match="body">
  <div class="body" >
    <xsl:apply-templates select="*"/>
  </div>
</xsl:templates>

<xsl:template match="p">
  <div class="p">
    <xsl:apply-templates/>
  </div>
</xsl:template>

[XHTML result]
<div class="body">
  <div class="p">Paragraph 1</div>
  <div class="p">Paragraph 2</div>
  <div class="p">Paragraph 3</div>
</div>

[Attached CSS stylesheets]
// CSS programmer will prefer to use below selector than adding new class value.
div.p{font-family:Arial;font-size=10pt;}
div.p:first-child{color:red;}
div.p:last-child{color:blue;}

In above example it is clear from XSL-FO that the aimed style has been applied 
before rendition (formatting) phase. In the CSS case the style is dynamically 
applied at rendering (formatting) phase. It needs more effort to debug the 
formatting results in CSS than XSL-FO.

The effort for maintaining and debugging for making publication does not become 
decreased by adopting of the CSS. Rather it will be increased by its 
architecture than XSL-FO especially in debugging.

I heard that production level CSS stylesheet become over 3000 steps. If the 
final publication is not so complex, CSS can be a good solution. However 
maintaining and debugging the styles for publication by CSS is not so easy than 
XSL-FO.

If my opinion has a misunderstanding, please indicate.

Regards,

-- 
/*--------------------------------------------------
 Toshihiko Makita
 Development Group. Antenna House, Inc. Ina Branch
 E-Mail tmakita(_at_)antenna(_dot_)co(_dot_)jp
 8077-1 Horikita Minamiminowa Vil. Kamiina Co.
 Nagano Pref. 399-4511 Japan
 Tel +81-265-76-9300 Fax +81-265-78-1668
 Web site:
 http://www.antenna.co.jp/
 http://www.antennahouse.com/
 --------------------------------------------------*/


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>