cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Björn Boxstart ...@bogaarts.nl>
Subject RE: adding an SVG element to xhtml
Date Wed, 14 Jun 2006 11:42:50 GMT
Hello Marco,
As Derek already says, please provide us the generated HTML. You could paste this HTML in
a local file and try to open it in FF. If that works, it could have something to do with FF
not recognizing the type of file correctly. You could then try to change your mapping in the
sitemap.xmap from svgtest to svgtest.html But first of all check what the generated HTML looks
like.
Kind regards,
Björn


________________________________________
Van: 321los@gmail.com [mailto:321los@gmail.com] 
Verzonden: woensdag 14 juni 2006 13:22
Aan: users@cocoon.apache.org
Onderwerp: Re: adding an SVG element to xhtml

Thank you for your answers so far.
I am using FF 1.5, so does my professor and we both are the only ones using it, so inline
SVG is no problem.

Derek, when I save the example of the page you linked http://wiki.svg.org/Inline_SVG?title=Inline_SVG

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:svg="http://www.w3.org/2000/svg "
      xml:lang="en">
  <head>
    <title>SVG embedded inline in XHTML</title>
    <object id="AdobeSVG" classid="clsid:78156a80-c6a1-4bbf-8e6a-3cd390eeb4e2"></object>

    <?import namespace="svg" implementation="#AdobeSVG"?>
  </head>
  <body>
    <h1>SVG embedded inline in XHTML</h1>
    <svg:svg width="300" height="200"> 
      <svg:circle cx="150" cy="100" r="50" />
    </svg:svg>
  </body>
</html>

as say. svg.xhtml, the page appears in my browser. Everything is okay. 


But when I try to copy the same content into an xsl stylesheet, it displays nothing but the
title and h1 headline, the black circle is omitted. It looks like that

sitemap.xmap:
    <map:match pattern="svgtest"> 
           <map:generate type="file" src="svg.xml"/>
           <map:transform src="svg.xslt"/>
      <map:serialize type="xhtml"/>
   </map:match> 


svg.xml:
    <?xml version="1.0" encoding="ISO-8859-1"?>
<document>
    <title>SVG embedded inline in XHTML</title>
    <h1>SVG embedded inline in XHTML</h1> 
</document>


svg.xslt:
    <xsl:stylesheet version="1.0"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   xmlns:svg=" http://www.w3.org/2000/svg" 
   xmlns:xlink="http://www.w3.org/1999/xlink">
 
         <xsl:template match="document">   
             <html>
                   <head>
                    <title><xsl:value-of select="title"/></title>
                    <object id="AdobeSVG" classid="clsid:78156a80-c6a1-4bbf-8e6a-3cd390eeb4e2"></object>

                    <?import namespace="svg" implementation="#AdobeSVG"?>
                  </head>
                  <body>
                    <h1><xsl:value-of select="h1"/></h1>

                    <svg:svg width="300" height="200">
                      <svg:circle cx="150" cy="100" r="50" />
                    </svg:svg> 
                  </body>
            </html>
         </xsl:template>
    </xsl:stylesheet>
    
    
If s.o. could tell me, what I am doing wrong or forgetting, then maybe my "real" problem from
my 1st post with the map gets clearer to me. 
Thanks again    




2006/6/14, Derek Hohls <DHohls@csir.co.za>:
Agreed.  Those following this thread can look at:

http://wiki.svg.org/Inline_SVG?title=Inline_SVG

Quote from near the end:

"This technique also works as expected in Opera 9. 
However it does not appear to work in beta versions of Internet Explorer 7.
What if you want to use an SVG implementation other than Mozilla or ASV
to render inline SVG?
You'll have to investigate yourself.
Please update this document to reflect your findings when you do. "


>>> bb@bogaarts.nl 2006/06/14 10:07 AM >>>

Indeed it looks like whatever solution you choose, you will still have to deal with the different
browser types. The latest version of firefox does support inline SVG (see their website).
And you could use the solution that I proposed before for IE. 
Björn

-----Oorspronkelijk bericht-----
Van: Derek Hohls [mailto:DHohls@csir.co.za]
Verzonden: woensdag 14 juni 2006 8:36
Aan: users@cocoon.apache.org
Onderwerp: RE: adding an SVG element to xhtml

Hmm.  I have never been able to get the <embed> tag to work in
Firefox.  Please let us know how this is done.

As a sidenote; working with SVG across multiple types of browsers is, 
unfortunately, quite problematic at present.  Best to apply it in a
situation where you know what the end users software is eg. an
intraweb.

In the worst case, you could transform the SVG to JPEG - using a 
method similar to the one below - and this will display OK in all
browsers.

>>> bb@bogaarts.nl 2006/06/14 08:28 AM >>>

Hello Marco,
What you are trying to do is to create inline SVG in an HTML page like you would do in XSL-FO
files. This is possible, but your solution would need a different approach per browser. However,
I think that it would be a much easier solution to create one more page that just creates
the SVG image. You would refer to this image from the HTML page that you create (by using
the 'src' attribute). 
This could look something like:
<embed src="cocoon/mymapgenerator.xml" width="625" height="392.5" type="image/svg+xml"
/>
Be sure to set the correct content type in the page that generates the image 
You could pass parameters to the page that creates the image to make the image generation
dynamic.
I hope this helps!
Björn
________________________________________
Van: 321los@googlemail.com [mailto:321los@googlemail.com]
Verzonden: dinsdag 13 juni 2006 18:01
Aan: users@cocoon.apache.org
Onderwerp: adding an SVG element to xhtml

Hi,

when generating a pdf in which I want to include an SVG element, I can do it like that:

....
<fo:instream-foreign-object>
                     <svg  xmlns=" http://www.w3.org/2000/svg" width="150px"
height="177px" viewBox="0 0 150 177"                                                                    
xml:space="preserve"> 

                           <svg:image x="0" y="0" width="150px"
height="177px"
                                   xlink:href=" http://localhost:8080/cocoon/map.jpg">
                           </svg:image>

                         <g id="arrow" style="fill: white; stroke:
blue;">
                            <line stroke-width="3" x1="{$r_pfeil}"
y1="{$hk}" x2="{$rk}" y2="{$hk}" /> 
                            <polygon points="{$rk} {$hk}, {$r_pf}
{$h_pf2}, {$r_pf} {$h_pf}" />
                           </g>
                          <circle cx="91" cy="44" r="2" style="fill:
white; stroke: black;"/> 
                          <circle cx="56" cy="89" r="2" style="fill:
white; stroke: black;"/>
                          <circle cx="101" cy="84" r="2" style="fill:
white; stroke: black;"/> 
                          <circle cx="42" cy="43" r="2" style="fill:
white; stroke: black;"/>
                          <circle cx="72" cy="128" r="2" style="fill:
white; stroke: black;"/> 
                        <text style="font-size: 10; font-weight:
bold;" x="94" y="49">place a</text>
                        <text style="font-size: 10; font-weight:
bold;" x="58" y="94">place b</text> 
                                      </svg>
                </fo:instream-foreign-object>

now, I want to include the same object in my xhtml file, (generate xml file, transform xsl-->output=xhtml).


I am wondering, what the syntax is like; that does not seem to work:
<
object  type="image/svg+xml">
   <svg  xmlns="http://www.w3.org/2000/svg " width="150px"
        height="177px" viewBox="0 0 150 177"    xml:space="preserve">


                   <svg:image x="0" y="0" width="150px" height="177px"

                          xlink:href="
http://localhost:8080/cocoon/map.jpg">
                    </svg:image>
                    ...
                    ....
<object>
plus, do I need to add s.th in the sitemap?

Just FYI, my aim is to display a map (the map.jpg in the svg:image tag) and draw an arrow
into the map, depending on the chosen place. place a and place b (in the text tag) are static,
the arrow is generated dynamically 

Thank you very much
Marco


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org 
For additional commands, e-mail: users-help@cocoon.apache.org



--
This message is subject to the CSIR's copyright, terms and conditions and
e-mail legal notice. Views expressed herein do not necessarily represent the 
views of the CSIR.

CSIR E-mail Legal Notice
http://mail.csir.co.za/CSIR_eMail_Legal_Notice.html

CSIR Copyright, Terms and Conditions
http://mail.csir.co.za/CSIR_Copyright.html

For electronic copies of the CSIR Copyright, Terms and Conditions and the CSIR
Legal Notice send a blank message with REQUEST LEGAL in the subject line to 
HelpDesk@csir.co.za.


This message has been scanned for viruses and dangerous content by MailScanner,
and is believed to be clean.


--------------------------------------------------------------------- 
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org 



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org



--
This message is subject to the CSIR's copyright, terms and conditions and
e-mail legal notice. Views expressed herein do not necessarily represent the 
views of the CSIR.

CSIR E-mail Legal Notice
http://mail.csir.co.za/CSIR_eMail_Legal_Notice.html

CSIR Copyright, Terms and Conditions
http://mail.csir.co.za/CSIR_Copyright.html

For electronic copies of the CSIR Copyright, Terms and Conditions and the CSIR
Legal Notice send a blank message with REQUEST LEGAL in the subject line to 
HelpDesk@csir.co.za.


This message has been scanned for viruses and dangerous content by MailScanner,
and is believed to be clean.


--------------------------------------------------------------------- 
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org 



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message