See below
----- Original Message -----
From: "Mitchell, Lincoln L."
<Lincoln(_dot_)Mitchell(_at_)woodside(_dot_)com(_dot_)au>
To: "XSL-List (E-mail)" <XSL-List(_at_)lists(_dot_)mulberrytech(_dot_)com>;
"svg-Developers(_at_)Yahoogroups(_dot_) Com (E-mail)"
<svg-developers(_at_)yahoogroups(_dot_)com>
Sent: Sunday, August 31, 2003 6:08 AM
Subject: [xsl] XSLT Cookbook - HELP
Hi all,
I am newish to XSLT and brought the book 'XSLT Cookbook', after reading
"Beginning XSLT". I am trying to work through the "XML to SVG" chapter.
However, I find the book VERY disorganized. I
have spent the best part of my weekend trying to marry up code in the
book
with the downloaded code files and then trying to get the examples to run.
In some cases the code is very different, where
comments are removed (fair enough) but also whole new blocks of code are
added ??????????. I think even advanced XML/XSLT users would find this a
hassle.
The online reviews I have read for this book say it's excellent! And I
am
hoping it is just my lack of experience with XML and XSLT that is the main
problem and that someone out there can help (Sol?,
Jenny?).
Q1. How do I run the code on page 338 ("test-axis3" not "test-axis1" as
expected), using Xalan? It seems to me that there is no XML data file to
transform and produce "axis3.svg". ?
Your first problem here (and admittedly this is my fault) is that the
much
of the code in this chapter will only work with Saxon. The code in this
chapter is some of the most complex in the book and it relies on
Saxon's
ability to transparently convert result tree fragments to nodesets when
<xsl:stylesheet version="1.1" as used in svg-utils.xslt. This does not
work
with Xalan. I attempted to port the svg chapter to Xalan by introducing
a
version of svg-utils that used the exsl:node-set conversion function
instead, but I then ran into some legitimate Xalan bugs and gave up. I
will
try to resurrect that Xalan version and if I get it to work I will post
it
on the O'Reilly site. Possibly the latest Xalan version will work
better
than the one I was using at the time.
If you are willing to use Saxon then this and all the other
test-xxx.xslt
files can be run on any input whatsoever since the tests are self
contained.
I often use the transform as the input file.
For example:
saxon test-axis3.xslt test-axis3.xslt > axis.svg
produces axis.svg containing:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg
PUBLIC "-//W3C//DTD SVG 1.0/EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg width="300" height="300">
<svg:g xmlns:svg="http://www.w3.org/2000/svg"
xmlns:emath="http://www.exslt.org/math" transform="translate(30,270)
scale(24,-1) translate(0,0)">
<svg:line x1="0" y1="0" x2="10" y2="0" id="_xaxis"
style="stroke-width:0.5;stroke:black"/>
<svg:line x1="0" y1="4" x2="0" y2="-4"/>
<svg:text x="0" y="-4" transform="translate(0,-4)
scale(0.041666666666666664,-1) translate(0,4)"
style="text-anchor:middle;font-size:8;baseline-shift:-110%"
dy="0">0.0</svg:text>
<svg:line x1="0.25" y1="2" x2="0.25" y2="-2"/>
<svg:line x1="0.5" y1="2" x2="0.5" y2="-2"/>
<svg:line x1="0.75" y1="2" x2="0.75" y2="-2"/>
etc ...
Q2. Is there additional support info about this book about the
downloaded
code and how to run them. If there is not, I strongly recommend one be
created.
The readme files were intened to provide this but I seemed to miss some of
the chapters including this one. I will remedy that and provide some
overall
introductory help and post it on the O'Reilly site.
P.S.
1) My name is Sal not Sol.
2) Jenny was the tech editor so I would not expect her to provide tech
support post production! :-)
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list