|
Post by isammoc on Jul 27, 2014 13:29:52 GMT -8
Hello everyone, This is my first post to ask your help.
I cannot find any resources about how to make a stylesheet. I even did not find a sample XML (Dresden or Tiltyard).
Can someone points resources about this ?
Thanks
|
|
|
Post by alandau on Jul 27, 2014 20:28:43 GMT -8
The short version: Copy an existing stylesheet and make changes until you get what you want. The current format is not great and not terribly well-defined. (IIRC, the Dresden server uses a different stylesheet format that isn't compatible with the Stanford/GGP-Base/Tiltyard stylesheet format; a shame, because they have a lot of stylesheets for games with no visualizations currently on ggp.org.) XSLT is also very restrictive and difficult to develop in. For one competition, I wrote a visualization for a Rubik's cube in isometric perspective (currently missing, unfortunately) that took days to develop because I had to hack around its lack of basic programming constructs. I know Sam has been interested in figuring out a new format that's easier to develop, but that hasn't happened yet. That said, the best approach is to start with an existing game's stylesheet and adjust from there. You can grab the XSLT files from games.ggp.org/base/ by clicking on the monitor icon next to a game. The XSLT file is going to process an XML file that's given the current state of the game (just the "true" relations), and the result should be the HTML visualization of that state of the game. For example, from a randomly selected file, we have the tag: <xsl:if test="//fact[relation='cell' and argument[1]=$col and argument[2]=$row and argument[3]='red']"> This tests if the current state includes (true (cell $col $row red)), where $col and $row are variables that were defined earlier in this section of the XSLT file. If so, the contents of the xsl:if block are included in the resulting file. I've found this to be a pretty good reference for what you can do in an XSLT file: www.w3schools.com/xsl/
|
|
|
Post by isammoc on Jul 27, 2014 22:12:44 GMT -8
Thanks for the answer.
I am pretty fluent with XML and XSLT (I developed an e-learning site mainly in perl, XML, and XSLT years ago)
I saw that stylesheets exist in the different games repositories (but I didn't try to read them yet)
It is unfortunate that there is no documentation about neither XML format nor XSL recommendation.
Thanks again for the answer
|
|
|
Post by Andrew Rose on Aug 13, 2014 11:31:47 GMT -8
As an encouragement to get stuck in, I produced a visualization for Sudoku and got it added to Tiltyard (by asking Sam nicely) in a couple of hours. I did it just by looking at some of the existing examples.
|
|