[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: How do I display an SVG file using XSLT?

Subject: Re: How do I display an SVG file using XSLT?
From: Greg Faron <gfaron@xxxxxxxxxxxxxxxxxx>
Date: Thu, 21 Nov 2002 12:15:49 -0700
display image using xsl
  Forgetting for the moment the SVG issues, you're basically asking:
How do I convert the element

<image NAME="images/svg_test.svg" WIDTH="219" HEIGHT="174" />

into


<object data="images/svg_test.svg" width="219" height="174"
type="image/svg+xml"></object>

?


Looking at your template...

               <xsl:attribute name="type">
                  <xsl:value-of select="image/svg+xml" />
               </xsl:attribute>

Here's your immediate problem. The value-of above implies that there exists in the xml the following structure:
<image NAME="..." WIDTH="..." HEIGHT="...">
<image>
<svg+xml>...</svg+xml>
</image>
</image>


What you mean to say is <xsl:text>image/svg+xml</xsl:text> since that is the literal string that you wish to appear as the 'type' value.

Your whole template above can be written as
<xsl:template match="image">
<object type="image/svg+xml">
<xsl:attribute name="data"><xsl:value-of select="@NAME"/></xsl:attribute>
<xsl:attribute name="width"><xsl:value-of select="@WIDTH"/></xsl:attribute>
<xsl:attribute name="height"><xsl:value-of select="@HEIGHT"/></xsl:attribute>
</object>
</xsl:template>


As for what fills the resultant object in your browser after this conversion, that is up to your browser configuration / object installation / registry settings.


Greg Faron Integre Technical Publishing Co.



XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.