CSCI 5733
XML Application Development
Summer 2009
Homework #4
Due date: August 3, 2009
Simplified fractal generator in SVG
Fractal contains recurring patterns. See http://www.mecxpert.de/svg/fractals.html for a simple introduction to IFS (Iterated Function Systems) fractal using the famous triangle fractal as an example.
Write a Java program, CreateFractal.java, and an XSLT program, generateFractal.xsl, for the generation of fractals in SVG format.
The Java program CreateFractal.java uses the service of generateFractal.xsl (but it is programmed in a way so it can also use other XSLT programs in the future.) It has exactly four command line arguments.
Java CreateFractal inputBaseFractal.svg fratcalTransform.xml generateFractal.xsl outputFractal.svg
inputBaseFractal.svg is the input base pattern of the fractal in SVG format that describes the basic pattern to recur. It uses a subset of SVG elements and additional elements and has the following requirements:
Note that a better design is to separate <fractal:data> into a separate XML file to decouple the basic pattern and the view option. (There means your XSLT program will need to handle two input XML documents probably using extensions.) However, to simplify development, this is not required or allowed here.
generateFractal.xsl is the XSLT program you need to develop to merge the two input files and produce the output SVG file. You must use XSLT in this project.
fratcalTransform.xml describes the transformation used to generate the patterns in the next depth. The DTD is:
<!ELEMENT FractalTransformation (transform+) >
<!ELEMENT transform (EMPTY) >
<!ATTLIST transform transform CDATA #REQUIRED>
outputFractal.svg is the output SVG file storing the generated fractal:
The following examples illustrate how the system works. Study the input and output files carefully.
(1) Triangle
Java CreateFractal triangle_1.svg triangle_base_1.xml generateFractal.xsl triangle_1_out.svg
Input files: triangle_1.svg, triangle_base_1.xml
Output SVG: triangle_1_out.svg
(2) Circle (Face)
Java CreateFractal circle4.svg FTBase_1.xml generateFractal.xsl circle4_out.svg
Input files: circle4.svg, FTBase_1.xml.
Output SVG: circle4_out.svg
(3) Ellipse
Java CreateFractal ellipse.svg FTBase_1.xml generateFractal.xsl
ellipse_out.svg
Input files: ellipse.svg, FTBase_1.xml.
Output SVG: ellipse_out.svg
(4) Rectangle animation
Java CreateFractal animate.svg FTBase_1.xml generateFractal.xsl animate_out.svg
Input files: animate.svg, FTBase_1.xml.
Output SVG: animate_out.svg
Put all your files into the directory hw/h4 directly under your dcmweb account (not under the pages subdirectory.) Turn in program listing and output SVG listing of the four cases included. It is extremely important to use standard names. I will use a script to test run your program with various test files. If you do not use standard names, the script may not work and you will be penalized.
As usual, good documentation is expected.