Graphviz Issue Tracker
Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0002189graphvizOutput Generationpublic2012-01-13 11:302012-01-13 11:36
Assigned To 
PlatformOSOS Version
Summary0002189: Add "xslStylesheet" graph attribute, in addition to "stylesheet"
DescriptionThe stylesheet graph attribute assumes that the stylesheet is CSS format. It's also permissible (and very useful) to use an XSL stylesheet, which can automatically transform the content of the SVG before displaying it (assuming the viewer correctly interprets it). Browsers such as Safari do currently perform this transformation automatically.

By allowing the XSL stylesheet to be correctly attached, GraphViz SVG output can be immediately transformed in compliant browsers without additional steps or tools, prior to rendering. Since the full XSLT 1.0 language is available, the opportunities to transform the result would provide a means to solve many of the transformations on SVG that are requested.
Additional Informationfrom gv_render_core.c -- we see the following code that inserts the stylesheet name, but assumes a type of text/css.

 if ((s = agget(job->gvc->g, "stylesheet")) && s[0]) {
        gvputs(job, "<?xml-stylesheet href=\"");
        gvputs(job, s);
        gvputs(job, "\" type=\"text/css\"?>\n");

GraphViz could support an "xslStylesheet" attribute, which would attach the stylesheet, emitting a header like this:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml-stylesheet href="%xslStylesheet%" type="application/xml"?>

Or, a stylesheetType attribute could be used:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml-stylesheet href="%stylesheet%" type="%stylesheetType"?>

TagsNo tags attached.
Attached Files? file icon [^] (8,534 bytes) 2012-01-13 11:31
? file icon zing.xsl [^] (930 bytes) 2012-01-13 11:32

- Relationships

-  Notes
User avatar (0000168)
rossjudson (reporter)
2012-01-13 11:36

The attached files show how an XSL transformation can be automatically applied to an SVG file, through a processing directive. has had the stylesheet directive modified to a type of application/xml. When viewed through a compatible browser like (say, Webkit-based), the zing.xsl transformation is automatically applied before viewing. In this case is simply changes some colors from black to blue.

It's easy to do things like strip out the fill and stroke attributes and replace them with classes, insert a block of CSS. As long as the geometry isn't changed by the transformation, the diagram will retain its structure well.

And while we're at it -- dot really, really needs a "class" attribute to pick up CSS styles. Right now overrides happen with the use of "fill" attributes in the output SVG, but with a transformation available that can remove those, it's much easier to use CSS.

- Issue History
Date Modified Username Field Change
2012-01-13 11:30 rossjudson New Issue
2012-01-13 11:31 rossjudson File Added:
2012-01-13 11:32 rossjudson File Added: zing.xsl
2012-01-13 11:36 rossjudson Note Added: 0000168

MantisBT 1.2.5[^]
Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker