Updated Branches:
  refs/heads/develop 196dd4b1c -> 5253db01b

transform.xslt now handles lineargradient transform (only 90 works for now)
More accurate tranformation of lineargradients' defs tag.


Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/dfb448bd
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/dfb448bd
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/dfb448bd

Branch: refs/heads/develop
Commit: dfb448bd69194fcfacb4b0ea4e98a2d22661eae3
Parents: 24de65c
Author: Om <[email protected]>
Authored: Sun Mar 31 02:43:48 2013 -0700
Committer: Om <[email protected]>
Committed: Sun Mar 31 02:43:48 2013 -0700

----------------------------------------------------------------------
 fxg2svg/transform.xslt |   40 +++++++++++++++++++++++++++++++++++++---
 1 files changed, 37 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/dfb448bd/fxg2svg/transform.xslt
----------------------------------------------------------------------
diff --git a/fxg2svg/transform.xslt b/fxg2svg/transform.xslt
index b1a7389..8dd36cc 100644
--- a/fxg2svg/transform.xslt
+++ b/fxg2svg/transform.xslt
@@ -25,11 +25,20 @@
        <xsl:output method="xml" encoding="UTF-8" indent="yes" />
 
        <xsl:template match="/">
+               <svg id="button">
                        <xsl:apply-templates mode="rect" />
+                       <xsl:apply-templates mode="text" />
+               </svg>
        </xsl:template>
        
        <xsl:template match="fx:Script" mode="#all" />
        <xsl:template match="fx:Metadata" mode="#all" />
+       
+       <xsl:template match="s:states" mode="rect">
+                       <xsl:for-each select="s:State">
+                                       <xsl:apply-templates mode="rect" />
+                       </xsl:for-each>
+       </xsl:template>
 
        <xsl:template match="s:Rect|Rect" mode="rect">
                <svg xmlns:xlink="http://www.w3.org/1999/xlink"; 
xmlns="http://www.w3.org/2000/svg";
@@ -116,6 +125,9 @@
                        <xsl:if test="not(@height) ">
                                        <xsl:attribute 
name="height">100%</xsl:attribute>
                        </xsl:if>
+                       <xsl:if test="not(s:fill) ">
+                                       <xsl:attribute 
name="fill">none</xsl:attribute>
+                       </xsl:if>
 
                        <xsl:apply-templates mode="rect" />
 
@@ -142,14 +154,17 @@
                        select="generate-id(.)" />)</xsl:attribute>
        </xsl:template>
        
-               <xsl:template match="s:LinearGradientStroke" mode="rect">
-               <xsl:attribute name="style">stroke:url(#<xsl:value-of
+       <xsl:template match="s:LinearGradientStroke" mode="rect">
+               <xsl:attribute name="style">stroke-width:<xsl:value-of 
select="@weight+1"></xsl:value-of>;stroke:url(#<xsl:value-of
                        select="generate-id(.)" />)</xsl:attribute>
        </xsl:template>
        
        <xsl:template match="//s:LinearGradient" mode="defs">
                <linearGradient>
                        <xsl:attribute name="id"><xsl:value-of 
select="generate-id()" /></xsl:attribute>
+                       <xsl:if test="@rotation">
+                               <xsl:attribute 
name="gradientTransform">rotate(<xsl:value-of select="@rotation" 
/>)</xsl:attribute>
+                       </xsl:if>                       
                        <xsl:apply-templates mode="defs" />
                </linearGradient>
        </xsl:template>
@@ -164,7 +179,7 @@
        <xsl:template match="//s:GradientEntry" mode="defs">
                <stop>
                        <xsl:attribute name="offset">
-                               <xsl:value-of 
select="@ratio*100"></xsl:value-of>
+                               <xsl:value-of select="@ratio"></xsl:value-of>
                        </xsl:attribute>
                        <xsl:attribute name="stop-color">#<xsl:value-of
                                select="substring-after(@color, '0x')" />
@@ -174,5 +189,24 @@
                        </xsl:attribute>
                </stop>
        </xsl:template>
+       
+<!-- Text -->
+
+       <xsl:template match="s:Label" mode="text" >
+       <svg>
+               <text>
+                       <xsl:if test="@id">
+                               <xsl:attribute name="id">
+                                       <xsl:value-of select="@id" />
+                               </xsl:attribute>
+                       </xsl:if>
+                       <xsl:attribute name="text-anchor">middle</xsl:attribute>
+                       <xsl:attribute 
name="pointer-events">none</xsl:attribute>
+                       <xsl:attribute name="dy">.3em</xsl:attribute>
+                       <xsl:attribute name="x">50%</xsl:attribute>
+                       <xsl:attribute name="y">50%</xsl:attribute>Hello</text>
+               </svg>  
+       </xsl:template> 
+       
 
 </xsl:stylesheet>

Reply via email to