Next in thread → Next in month →

RE: [docbook-apps] svg and <object> tag conflict

From
Day, Troy L <>
Date
2004-03-23T14:08:11+00:00
ID
B260051544212A4CBE15537FA4D665FFA03576@DENVERMBX
Thread
RE: [docbook-apps] svg and <object> tag conflict
The small modification was to utilize a
new parameter.

 

<xsl:param name="use.object.for.svg" select="'1'"/>

 

Which was used like this:

 

  <xsl:variable name="img">

    <xsl:choose>

          <xsl:when test="@format = 'SVG'">

          

          <!-- Removing object tag for svg files-->

          <xsl:if test="$use.object.for.svg != 0">

               
<object data="{$filename}" type="image/svg+xml">

                
<xsl:call-template name="process.image.attributes">

                
<!--xsl:with-param name="alt"
select="$alt"/ there's no alt here-->

                
<xsl:with-param name="html.depth" select="$html.depth"/>

                  
<xsl:with-param name="html.width" select="$html.width"/>

                  
<xsl:with-param name="longdesc" select="$longdesc"/>

                  
<xsl:with-param name="scale" select="$scale"/>

                  
<xsl:with-param name="scalefit" select="$scalefit"/>

                  
<xsl:with-param name="scaled.contentdepth" select="$scaled.contentdepth"/>

                  
<xsl:with-param name="scaled.contentwidth" select="$scaled.contentwidth"/>

                  
<xsl:with-param name="viewport" select="$viewport"/>

                
</xsl:call-template>

                
<xsl:if test="@align">

                  
<xsl:attribute name="align">

                      
<xsl:choose>

                        
<xsl:when test="@align = 'center'">middle</xsl:when>

                        
<xsl:otherwise>

                          
<xsl:value-of select="@align"/>

                        
</xsl:otherwise>

                      
</xsl:choose>

                  
</xsl:attribute>

                
</xsl:if>

          </xsl:if>

          

          <xsl:if test="$use.embed.for.svg != 0">

 

           
<embed src="{$filename}" type="image/svg+xml">         
         

             
<xsl:call-template name="process.image.attributes">

               
<!--xsl:with-param name="alt"
select="$alt"/ there's no alt here -->

               
<xsl:with-param name="html.depth" select="$html.depth"/>

               
<xsl:with-param name="html.width" select="$html.width"/>

               
<xsl:with-param name="longdesc" select="$longdesc"/>

               
<xsl:with-param name="scale" select="$scale"/>

               
<xsl:with-param name="scalefit" select="$scalefit"/>

               
<xsl:with-param name="scaled.contentdepth" select="$scaled.contentdepth"/>

               
<xsl:with-param name="scaled.contentwidth" select="$scaled.contentwidth"/>

               
<xsl:with-param name="viewport" select="$viewport"/>

             
</xsl:call-template>

           
</embed>

          </xsl:if>

          <!-- Removing object tag for svg files-->

          <xsl:if test="$use.object.for.svg != 0">

              
</object>

          </xsl:if>

      </xsl:when>

     

 

Perhaps this template could be componentized
in future releases to make customization more workable.

 

Thanks,

Troy

 

-----Original Message-----

From: Bob Stayton
[mailto:] 

Sent: Friday, March 19, 2004 4:17
PM

To: Day, Troy L;


Subject: Re: [docbook-apps] svg
and <object> tag conflict

 

The template that generates
the object element with embed inside (name="process.image" in
html/graphics.xsl) is a very large template (over 500 lines).  It has an
xsl:choose case for SVG (<xsl:when test="@format = 'SVG'">),
and it would not be difficult to remove the <object> element that it
generates.  But it means copying that large template to your customization
layer and making a small modification. That should work, but it means you will
have to check each stylesheet release to see if that big template has changed
at all, and repeat the process.

 

Bob Stayton

Sagehill Enterprises

DocBook Consulting



 

 

----- Original Message ----- 

From: Day, Troy L 

To: ''

Sent: Friday,
March 19, 2004 6:26 AM

Subject:
[docbook-apps] svg and <object> tag conflict

 

 

(How can I create an embed tag for
svg graphics without nesting it inside an <object> tag? )

 

Perhaps some clarification of 'why'
is in order.  I'm trying to include some complex svg graphics within
docbook for html transformation.  Although the svg graphic shows up fine
using the Adobe viewer, the svg scripting is not working.  The svg
software maker informed me :

 

"... the problem is,
that the <embed> tag is inside an <object> tag. The <object>
tag makes problems with svg and is not fully supported by all browsers."

 

Client is Using IE 6, so a nested embed tag should
work (and does work for simple viewing of the svg), but the svg javascript
files are not working.  

 

The curious thing is that if I save the transformed
file as an html file then view it from the file system like this:

 

C:\Inetpub\wwwroot\...\xml_translate[1].html

 

The svg and scripting works
fine.  It is only when the html markup is viewed from a URL like this:

 

http://localhost/.../xml_translate[1].html

 

does the problem occur.

 

This appears to be an
IE/<object> tag problem, so I want to simply use the embed tag not nested
within the object tag for svg graphics.  

 

Any ideas about how to customize
the xsl would be greatly welcome.

 

Thanks,

Troy
Next in thread → Next in month →