Loading ...
Sorry, an error occurred while loading the content.

Re: [svg-developers] Problem in Applying StyleSheet (SVG embedded) to XML Document

Expand Messages
  • Jiri Jirat
    Hello, first - I you sure, that you have MSXML parser installed? Best regards Jirka ... --
    Message 1 of 1 , Jan 31, 2001
    • 0 Attachment
      Hello,
      first - I you sure, that you have MSXML parser installed?

      Best regards
      Jirka

      sek_76@... wrote:
      >
      > Hey Guys,
      >
      > I have Plugin called SVGviewer.exe installed on my
      > system.It works fine .It renders all the SVG files.
      >
      > But my problem is that When i apply a styleSheet to
      > an XML embedded with SVG tags i dont get the output
      > What other Sites Claim.
      >
      > Tell me exactly which browser to Go For and Which Plugin.
      > If possible please try out this Code Before Giving a Suggestion.
      >
      > Like i tried with this code>>>>>>
      > Well this is my XML Code to Which i am applying a
      > StyleSheet.I am sending u Both the XML Document as
      > well as StyleSheet.
      >
      > I will be thankful to You if you can tell me Where
      > exactly the Problem lies.
      >
      > Is it with the Browser(IE 5.0 using) .
      >
      > I will be thankful to you if you can give me some
      > solution for this after asking yur technical team to
      > work on the Code what i have Sent.
      >
      > Because there will be no future to SVG if they can not
      >
      > be embedded in XSL.
      >
      > <?xml version="1.0"?>
      > <!-- edited with XML Spy v3.0 NT
      > (http://www.xmlspy.com) by Suresh (Antares) -->
      > <?xml-stylesheet type="text/xsl" href="svgsales.xsl"?>
      > <ROWSET>
      > <ROW num="1">
      > <ENAME>SMITH</ENAME>
      > <SAL>800</SAL>
      > </ROW>
      > <ROW num="2">
      > <ENAME>ALLEN</ENAME>
      > <SAL>1600</SAL>
      > </ROW>
      > <ROW num="3">
      > <ENAME>WARD</ENAME>
      > <SAL>1250</SAL>
      > </ROW>
      > <ROW num="4">
      > <ENAME>JONES</ENAME>
      > <SAL>2975</SAL>
      > </ROW>
      > <ROW num="5">
      > <ENAME>MARTIN</ENAME>
      > <SAL>1250</SAL>
      > </ROW>
      > <ROW num="6">
      > <ENAME>BLAKE</ENAME>
      > <SAL>2850</SAL>
      > </ROW>
      > <ROW num="7">
      > <ENAME>CLARK</ENAME>
      > <SAL>2450</SAL>
      > </ROW>
      > <ROW num="8">
      > <ENAME>SCOTT</ENAME>
      > <SAL>3000</SAL>
      > </ROW>
      > <ROW num="9">
      > <ENAME>KING</ENAME>
      > <SAL>5000</SAL>
      > </ROW>
      > <ROW num="10">
      > <ENAME>TURNER</ENAME>
      > <SAL>1500</SAL>
      > </ROW>
      > <ROW num="11">
      > <ENAME>ADAMS</ENAME>
      > <SAL>1100</SAL>
      > </ROW>
      > <ROW num="12">
      > <ENAME>JAMES</ENAME>
      > <SAL>950</SAL>
      > </ROW>
      > <ROW num="13">
      > <ENAME>FORD</ENAME>
      > <SAL>3000</SAL>
      > </ROW>
      > <ROW num="14">
      > <ENAME>MILLER</ENAME>
      > <SAL>1300</SAL>
      > </ROW>
      > </ROWSET>
      >
      > This is Style Sheet-Code
      >
      > <?xml version="1.0"?>
      > <xsl:stylesheet
      > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      > version="1.0"
      > xmlns:Color="http://www.oracle.com/XSL/Transform/java/java.awt.Color"
      >
      > xmlns:Integer="http://www.oracle.com/XSL/Transform/java/java.lang.Inte
      > ger"
      > exclude-result-prefixes="Color Integer">
      >
      > <xsl:output standalone="yes" media-type="image/svg"
      > />
      >
      > <xsl:template match="/">
      > <svg xml:space="preserve" width="1000" height="1000">
      > <desc>Salary Chart</desc>
      > <g
      > style="stroke:#000000;stroke-width:1;font-family:Arial;font-size:16">
      > <xsl:for-each select="ROWSET/ROW">
      > <xsl:call-template name="drawBar">
      > <xsl:with-param name="rowIndex" select="position()" />
      >
      > <xsl:with-param name="ename" select="ENAME" />
      > <xsl:with-param name="sal" select="number(SAL)" />
      > </xsl:call-template>
      > </xsl:for-each>
      > </g>
      > </svg>
      >
      > </xsl:template>
      > - <xsl:template name="drawBar">
      > <xsl:param name="rowIndex" select="number(0)" />
      > <xsl:param name="ename" />
      > <xsl:param name="sal" select="number(0)" />
      > <xsl:variable name="xOffset" select="number(100)" />
      >
      > <xsl:variable name="yOffset" select="number(20)" />
      > <xsl:variable name="barHeight" select="number(25)"
      > />
      > <xsl:variable name="gap" select="number(10)" />
      > <xsl:variable name="x" select="$xOffset" />
      > <xsl:variable name="y" select="$yOffset + $rowIndex
      > * ($barHeight + $gap)" />
      > <xsl:variable name="barWidth" select="$sal div
      > number(10)" />
      > <rect x="{$x}" y="{$y}" height="{$barHeight}"
      > width="{$barWidth}">
      > <xsl:attribute name="style">
      > <xsl:text>fill:#</xsl:text>
      > <xsl:call-template name="getCoolColorStr">
      > <xsl:with-param name="colorIndex" select="$rowIndex"
      > />
      > <xsl:with-param name="totalColors"
      > select="number(14)" />
      > </xsl:call-template>
      > <xsl:text />
      > </xsl:attribute>
      > </rect>
      > <xsl:variable name="fontHeight" select="number(18)"
      > />
      > <text x="20" y="{$y + $fontHeight}">
      > <xsl:value-of select="$ename" />
      > </text>
      > <xsl:variable name="x2" select="$xOffset + $barWidth
      > + 10" />
      > <text x="{$x2}" y="{$y + $fontHeight}">
      > <xsl:value-of select="$sal" />
      > </text>
      > </xsl:template>
      > <xsl:template name="getCoolColorStr">
      > <xsl:param name="colorIndex" />
      > <xsl:param name="totalColors" />
      > <xsl:variable name="SATURATION" select="number(0.6)"
      > />
      > <xsl:variable name="BRIGHTNESS" select="number(0.9)"
      > />
      > <xsl:variable name="hue" select="$colorIndex div
      > $totalColors" />
      > <xsl:variable name="c"
      > select="Color:getHSBColor($hue, $SATURATION,
      > $BRIGHTNESS)" />
      > <xsl:variable name="r" select="Color:getRed($c)" />
      > <xsl:variable name="g" select="Color:getGreen($c)"
      > />
      > <xsl:variable name="b" select="Color:getBlue($c)" />
      >
      > <xsl:variable name="rs"
      > select="Integer:toHexString($r)" />
      > <xsl:variable name="gs"
      > select="Integer:toHexString($g)" />
      > <xsl:variable name="bs"
      > select="Integer:toHexString($b)" />
      > <xsl:if test="$r < 16">0</xsl:if>
      > <xsl:value-of select="$rs" />
      > <xsl:if test="$g < 16">0</xsl:if>
      > <xsl:value-of select="$gs" />
      > <xsl:if test="$b < 16">0</xsl:if>
      > <xsl:value-of select="$bs" />
      > </xsl:template>
      > </xsl:stylesheet>
      >

      --
      <name firstName="Jirka" surname="Jirat"/>
      <mail> jiratj@... </mail>
      <support> http://www.zvon.org </support>
      <zvonMailingList> http://www.zvon.org/index.php?nav_id=4
      </zvonMailingList>
    Your message has been successfully submitted and would be delivered to recipients shortly.