Actually, you can do recursion, but overall I would agree that if you want
to use some sort of layout logic XSLT is going to be a PITA at best.  One
half-hearted suggestion: if you're a really experience c++ programmer,
rolling a quick command-line java program wouldn't be all that figure out,
and you could use the batik library to do it.  The code at the end is a very
simple example from the batik site (http://xml.apache.org/batik) that
generates a rectangle.  Other than getting the java sdk and a build
environment like ant, you could be up and running in minutes.

If you can't stand the java, I don't know of anything like this that exists
for c++.  Since you seem to only need a very few primitives, I would
recommend simply creating a small utility class that carries around either a
System.Xml.XmlDocument or a StringBuilder class and has a few methods to
create the primitives you need.

/////////////////// Sample Batik Code /////////////////////////
import java.awt.Rectangle;
import java.awt.Graphics2D;
import java.awt.Color;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.IOException;
import org.apache.batik.svggen.SVGGraphics2D;
import org.apache.batik.dom.GenericDOMImplementation;
import org.w3c.dom.Document;
import org.w3c.dom.DOMImplementation;

public class TestSVGGen {

    public void paint(Graphics2D g2d) {
        g2d.setPaint(Color.red);
        g2d.fill(new Rectangle(10, 10, 100, 100));
    }

    public static void main(String [] args) throws IOException {

        // Get a DOMImplementation
        DOMImplementation domImpl =
            GenericDOMImplementation.getDOMImplementation();

        // Create an instance of org.w3c.dom.Document
        Document document = domImpl.createDocument(null, "svg", null);

        // Create an instance of the SVG Generator
        SVGGraphics2D svgGenerator = new SVGGraphics2D(document);

        // Ask the test to render into the SVG Graphics2D implementation
        TestSVGGen test = new TestSVGGen();
        test.paint(svgGenerator);

        // Finally, stream out SVG to the standard output using UTF-8
        // character to byte encoding
        boolean useCSS = true; // we want to use CSS style attribute
        Writer out = new OutputStreamWriter(System.out, "UTF-8");
        svgGenerator.stream(out, useCSS);
    }
}

-----Original Message-----
From: svg-developers@yahoogroups.com [mailto:[EMAIL PROTECTED]
On Behalf Of jophof007
Sent: Tuesday, August 02, 2005 2:09 PM
To: svg-developers@yahoogroups.com
Subject: [svg-developers] Re: Newbie SVG Developer

Building complex logic in XSLT is very hard to do. Some if else is
possible but not recursion for example sometimes needed for complex
algorithms.

John
--- In svg-developers@yahoogroups.com, "Chris Serio" <[EMAIL PROTECTED]> wrote:
> Yeah i'd be using .NET. I'm not sure what XSLT is but i'm going to 
> look into it right now...The database is pretty simple but the 
> drawing needs to have some logic to it so that wires don't cross on 
> the schematic etc.
> 
> The database will just be a from-connector #, from-pin #, to-
> connector #, to-pin # and some wire gauge/type for each.
> 
> Chris
> 
> 
> --- In svg-developers@yahoogroups.com, "William McKenzie" <[EMAIL PROTECTED]> 
> wrote:
> > What sort of c/c++ environment are you using?  One option would be 
> to find
> > something like 'kode' (part of debian linux, I believe) that would 
> generate
> > c++ classes or templates from the RelaxNG schema for svg.  Those 
> classes
> > could then be used to generate SVG objects.  If you are in the .NET
> > environment, you might want to consider using ADO.NET to get your 
> database
> > objects as XML, and then using XSLT to transform them into SVG.  
> Really
> > fairly flexible and elegant, if you can deal with XSLT.
> > 
> > ~Bill
> > 
> > -----Original Message-----
> > From: svg-developers@yahoogroups.com [mailto:svg-
> [EMAIL PROTECTED]
> > On Behalf Of Chris Serio
> > Sent: Tuesday, August 02, 2005 11:47 AM
> > To: svg-developers@yahoogroups.com
> > Subject: [svg-developers] Re: Newbie SVG Developer
> > 
> > Thanks for the info. I was hoping to find a high level API with 
> basic 
> > functions built into it like "DrawColoredRectangle
> > (x,y,len,width,color)"
> > 
> > There's a very near deadline on this project so i'm trying to get a 
> > library with the most comprehensive API i can.
> > 
> > Chris
> > 
> > 
> > --- In svg-developers@yahoogroups.com, Holger Will <[EMAIL PROTECTED]> 
> > wrote:
> > > Chris Serio schrieb:
> > > 
> > > > Hey all,
> > > >
> > > > I'm new to SVG. I've never used it before but i want to use it 
> to
> > > > generate images that can be used in Visio (which can open SVG),
> > > > possibly convert to PDF and also view on the web. The images 
> will 
> > be
> > > > generated by a program i want to write which will interpret 
> some 
> > data
> > > > in a database.
> > > >
> > > > Basically i'm making schematics for a wiring diagram and i will 
> > have
> > > > connector types saved in a database as well as to/from pin 
> > routings.
> > > > >From this data i want to generate the schematic using SVG.
> > > >
> > > > I'm proficient in C/C++ but i'm not sure where to begin. Is 
> there 
> > an
> > > > SVG SDK for C/C++ out there somewhere?
> > > >
> > > > Thanks for any suggestions,
> > > > Chris
> > > 
> > > Hi Chris
> > > 
> > > i dont know any c/c++ , but as svg is just plain simple xml, you 
> > should 
> > > be able to build your svgs with any xml lib.
> > > for more advanced features including rendering, and rendering to 
> > pdf see:
> > > http://cairographics.org/introduction
> > > and
> > > http://cairographics.org/libsvg
> > > 
> > > or if you could use Java, there is the Apache Batik project, 
> which 
> > is 
> > > the most complete open source SVG implementation.
> > > http://xml.apache.org/batik/
> > > 
> > > and if you are on Linux have a look at
> > > http://librsvg.sourceforge.net/
> > > 
> > > or if you plan to have a GUI , and want that to be portable, you 
> > migth 
> > > as well think of building a XUL app, using mozilla svg.
> > > http://www.mozilla.org/projects/svg/
> > > http://www.xulplanet.com/
> > > 
> > > as i said i dont know c/c++ ,
> > > hope it helps anyways
> > > Holger
> > 
> > 
> > 
> > 
> > 
> > -----
> > To unsubscribe send a message to: svg-developers-
> [EMAIL PROTECTED]
> > -or-
> > visit http://groups.yahoo.com/group/svg-developers and click "edit 
> my
> > membership"
> > ---- 
> > Yahoo! Groups Links






-----
To unsubscribe send a message to: [EMAIL PROTECTED]
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my
membership"
---- 
Yahoo! Groups Links



 





------------------------ Yahoo! Groups Sponsor --------------------~--> 
<font face=arial size=-1><a 
href="http://us.ard.yahoo.com/SIG=12h4t5rf1/M=362131.6882499.7825260.1510227/D=groups/S=1706030389:TM/Y=YAHOO/EXP=1123017809/A=2889191/R=0/SIG=10r90krvo/*http://www.thebeehive.org
">Get Bzzzy! (real tools to help you find a job) Welcome to the Sweet Life 
- brought to you by One Economy</a>.</font>
--------------------------------------------------------------------~-> 

-----
To unsubscribe send a message to: [EMAIL PROTECTED]
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my 
membership"
---- 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/svg-developers/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to