Does anyone have an example svg example using xslt? I tried the 
following example and it didn't work. The following is an example 
from the book "Fundamentals of SVG Programming Concepts to Source 
Code" by Oswald Campesato (ISBN 1-58450-298-3) wich is a very good 
book with some highly mathematical examples. However the example I 
tried doesn't work with the IE 6 xslt processor. It is geared toward 
saxon. 
   It is highly likely that I have inserted an error when I added 
the second <xsl tag to the xsl file. It is also likely that some 
other syntax error slipped through my attempts at debugging. 
   I will greatly apreciate any help on this matter and replies can 
be sent to my email in addition to the list. I want to develop a 
small library of specialized graphing functions to help me with 
automated quality reporting. I will post to this forum my first 
milestone if I think it will help others with similar goals.

Thank you for you time in reading this,
John

xml File xsltToSVG1.xml pg.389
_______________________________________________________
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="xsltToSVG1.xsl"?>
<objects>
   <object>
    <type>rect</type>
       <x>50</x>
       <y>50</y>
       <width>100</width>
       <height>50</height>
       <style>fill:red</style>
   </object>
   <object>
     <type>polygon</type>
     <points>300,50 450,50 350,100 300,150 </points>
     <style>fill:blue</style>
   </object>

   <object>
     <type>ellipse</type>
        <cx>300</cx>
        <cy>100</cy>
        <rx>100</rx>
        <ry>50</ry>
        <style>fill:blue</style>
   </object>
</objects>



xsltToSVG1.xls  page 390
______________________________________________________________

<?xml version="1.0" ?>
<xsl:stylesheet
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
    version="1.0">
<xsl:output method="xml" indent="yes"
doctype-public="-//W3C//DTD SVG 1.0//EN"
doctype-system="http://www.w3.org/TR/2001/REC-SVG-
20010904/DTD/svg10.dtd"/>

<xsl:template match="/">
    <svg>
          <g>
              <xsl:apply-templates/>
          </g>
    </svg>
</xsl:template>


<xsl:template match="objects/object">
  <xsl:for-each select=".">
    <xsl:choose>
    <xsl:when test="./type ='rect'">
        <xsl:call-template name="createRectangle"/>
    </xsl:when>

   <xsl:when test="./type = 'polygon'">
      <xsl:call-template name="createPolygon"/>
   </xsl:when>
   </xsl:choose>
  </xsl:for-each>
</xsl:template>

  <xsl:template name="createRectangle">
     <xsl:variable name="x"   select="./x"/>
     <xsl:variable name="y"   select="./y"/>
     <xsl:variable name="width"  select="./width"/>
     <xsl:variable name="height" select="./height"/>
     <xsl:variable name="style"  select="./style"/>

     <rect x="{$x}"     y="{$y}"
           width="{$width}" height="{$height}"
             style="{$style}"/>
   </xsl:template>

  <xsl:template name="createPolygon">
     <xsl:variable name="points" select="./points" />
     <xsl:variable name="style" select="./style"/>

    <polygon points="{$points}" style="{$style}"/>
    </xsl:template>
    </xsl:stylesheet>




-----
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