Subject: Re: [xsl] SVG object creation with XSLT using successive abstraction layers From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Thu, 03 Nov 2005 17:08:27 -0500 |
<box x="40" y="30" width="300" height="150"/> <drawX x="40" y="30" width="300" height="150" stroke-width="6"/>
<svg:rect class="box" x="40" y="30" width="300" height="150"/> <svg:path d="M 40 30 L 340 180 M 40 180 L 340 30" stroke-width="6"/>
<xsl:template match="box"> <svg:rect class="box" width="{@width}" height="{@height}"> <xsl:copy-of select="@x|@y"/> </svg:rect> </xsl:template>
<xsl:template match="drawX"> <xsl:variable name="x1" select="@x"/> <xsl:variable name="x2" select="@x + @width"/> <xsl:variable name="y1" select="@y"/> <xsl:variable name="x2" select="@y + @height"/> <svg:path d="M {$x1} {$y1} L {$x2} {$y2} M {$x1} {$y2} L {$x2} {$y1}"> <xsl:copy-of select="@stroke-width"/> </svg:path> </xsl:template>
<xsl:template match="xbox"> <xsl:variable name="expanded"> <box height="{@width div 2}"> <xsl:copy-of select="@x | @y | @width"/> </box> <drawX height="{@width div 2}"> <xsl:copy-of select="@x | @y | @width | @stroke-width"/> </drawX> </xsl:variable> <xsl:apply-templates select="$expanded"/> </xsl:template>
Cheers, Wendell
I'd suggest perhaps considering pipelining (executing a series of stylesheets, each one using the output of the last). It's difficult to recommend anything specific without knowing details of the system. But essentially something checks the results of the transformation, and if it still contains higher, run the stylesheet on it again. I suggest this because I've found converting into SVG tends to be easier as a sequence of transformations.
====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] SVG object creation with , Jon Gorman | Thread | [xsl] Concordance with XSLT, Rick Quatro |
Re: [xsl] Recursion problem with Fi, Manfred Staudinger | Date | Re: [xsl] Recursive substitution, Agnisys |
Month |