Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
| Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old February 15th, 2006, 06:06 PM
Registered User
 
Join Date: Feb 2006
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default XML to SVG with XSLT

Hi!

I´m trying to transform a xml-file to svg:

My XML:
 
Quote:
quote:
Quote:
<?xml version="1.0" encoding="ISO-8859-1"?>
      <?xml-stylesheet version="1.0" href="kreise.xsl" type="text/xsl"?>

      <kreise>

        <kreis>
          <mittelpunkt_x>100</mittelpunkt_x>
          <mittelpunkt_y>150</mittelpunkt_y>
          <radius>50</radius>
          <farbe>red</farbe>
        </kreis>

        <kreis>
          <mittelpunkt_x>300</mittelpunkt_x>
          <mittelpunkt_y>250</mittelpunkt_y>
          <radius>70</radius>
          <farbe>blue</farbe>
        </kreis>

      </kreise>
And here is my xsl:
 
Quote:
quote:
Quote:

  <xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<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>

      <text x="20" y="20">Dieses SVG-Dokument wurde mittels XSLT
        aus einem XML-Dokument generiert.</text>

      <xsl:for-each select="kreise/kreis">
      <circle>

      <xsl:attribute name="cx">
        <xsl:value-of select="mittelpunkt_x" />
      </xsl:attribute>

      <xsl:attribute name="cy">
        <xsl:value-of select="mittelpunkt_y" />
      </xsl:attribute>

      <xsl:attribute name="r">
        <xsl:value-of select="radius" />
      </xsl:attribute>

      <xsl:attribute name="fill">
        <xsl:value-of select="farbe" />
      </xsl:attribute>

      </circle>
      </xsl:for-each>


      </svg>

      </xsl:template>
      </xsl:stylesheet>
Can anyone tell me, why my IE6 can´t show me the kreis.svg ??

Thanx!
AJ


  #2 (permalink)  
Old February 15th, 2006, 06:30 PM
mhkay's Avatar
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

This is like one of those questions that goes: a farmer has three daughters, ...[lots of details of the ages of the daughters]... and ends "does the farmer have a dog?"

Because the problem, as far as I can see, is nothing to do with the details of your source XML or your XSLT code, it's all to do with the capabilities and configuration of IE and its plugins. (Which is not something I can help you with.)

You didn't actually tell us whether you were running the transformation in the browser.

It would also be useful to know whether you can successfully display HTML pages that contain directly-embedded SVGs.



Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
  #3 (permalink)  
Old February 15th, 2006, 07:26 PM
Registered User
 
Join Date: Feb 2006
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanx for your reply.

I´m using IE6 and the SVG Plugin 3.03. I can view an svg-file embedded in HTML. My Problem is, how can I view the transformed xml-file ? I know, I have to save that transformed xml-file as SVG, but I can´t see anything in IE.
Viewing the saved svg-code, there is only the xml-code !!??
Why does my msxml6.0 (!) can´t transform the xml-file ??

Thanx !
AJ



Similar Threads
Thread Thread Starter Forum Replies Last Post
xml and xsl templates as input to xslt gives xml rameshnarayan XSLT 5 August 3rd, 2005 01:58 AM
XSLT read through XML to transform another XML dendenx2 XSLT 8 July 7th, 2005 08:18 PM
XSLT for complicated xml to xml transf. required doug@sirvisetti XSLT 3 June 17th, 2005 04:26 PM
merge two xml file and make new xml using xslt ketan XSLT 0 September 21st, 2004 08:48 AM
Merge XML files into a xml file using xslt lxu XML 4 November 6th, 2003 06:01 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.