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

question on line breaks / chess

Subject: question on line breaks / chess
From: Hermann Stamm-Wilbrandt <STAMMW@xxxxxxxxxx>
Date: Fri, 17 Jul 2009 05:55:11 +0200
 question on line breaks / chess
Hello,

in the past I created quite some chess animations using shell scripting,
netpbm tools and gifsicle, see eg:
http://www.stamm-wilbrandt.de/chess/en/sct_map.html


Now I tried to do chess diagrams with XSLT.
Since it should work in browsers I am bound to XSLT 1.0.

The position is stored in board.xml, and the transform is board.xsl.
The stylesheet is referenced by <?xml-stylesheet ...?> in board.xml.

The display of board.xml is not nice because of additional vertical
spacing, but running "xsltproc board.xsl board.xml >board.html" and
viewing board.html all is fine:
http://www.stamm-wilbrandt.de/en/xsl-list/chess/board.xml
http://www.stamm-wilbrandt.de/en/xsl-list/chess/board.html


Now I have three questions:
1) How can I inspect the output of the transformation in the browser?
   "View source" does not help since it shows the XML input.

2) How can I make the output of the browser transformation similar to
   that of xsltproc?

   board.html looks like this, all in a single line (split into many
   lines here for readybility, only):
   <html><table border="1"><tr><td><img src="gif/brw.gif"><img src="gif/
   bnb.gif"><img src="gif/bbw.gif"><img src="gif/bqb.gif"><img src="gif/
   bkw.gif"><img src="gif/bbb.gif"><img src="gif/bnw.gif"><img src="gif/
   brb.gif"><br><img src="gif/bpb.gif">...
   ...<img src="gif/wrw.gif"><br></td></tr></table></html>

3) Is there a better way than having template matching "f" with mode in
   order to handle field background color appropriately?

  ...
  <xsl:template match="row">
    <xsl:choose>
      <xsl:when test="(position() mod 2)=0">
        <xsl:apply-templates select="f" mode="w"/><br/>?
      </xsl:when>
      <xsl:otherwise>
        <xsl:apply-templates select="f" mode="b"/><br/>?
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="f" mode="w">
    <xsl:call-template name="img">>
      <xsl:with-param name="pos" select="position()+0"/>
    </xsl:call-template>
  </xsl:template>

  <xsl:template match="f" mode="b">
    <xsl:call-template name="img">>
      <xsl:with-param name="pos" select="position()+1"/>
    </xsl:call-template>
  </xsl:template>
  ...



Mit besten Gr|_en / Best wishes,

Hermann Stamm-Wilbrandt
Developer, XML Compiler
WebSphere DataPower SOA Appliances
----------------------------------------------------------------------
IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Martin Jetter
Geschdftsf|hrung: Erich Baier
Sitz der Gesellschaft: Bvblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294

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.