You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by benjamin pignier <be...@yahoo.fr> on 2001/06/07 13:22:23 UTC

Cocoon, XML and SVG !

Hi !

I am using Cocoon 1.8.2, SVG Viewer 2.0 Beta and IE
5.5

I'm working on a project running with Cocoon, SVG and
XML.
In fact, I'm trying to create an SVG file with an XML
and an XSL.
The XML file contains all the informations I need to
display inside.
The XSL file succeed in transforming this file into
SVG, reproducing correctly the information initially
inside the XML file.

The problem is that Cocoon adds this heading on each
new page containing SVG code :
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
"http://www.w3.org/TR/REC-html40/strict.dtd">
instead of just <?xml version="1.0"?> which is what we
need to make our svg works correctly

Moreover, we tried and call the svg plugin thanks to
the "<output...>" tag but this did not work

Please run these files in your browser with Cocoon and
look :
Thank you for your help !
Benjamin
___________________
File1 : xmltest.xml
___________________

<?xml version="1.0"?>
<!DOCTYPE root [
	<!ELEMENT root ANY>
	<!ELEMENT texte ANY>
	<!ELEMENT rire (#PCDATA)>
	]>

<?xml-stylesheet href="xmltest.xsl" type="text/xsl" ?>
<?cocoon-process type="xslt"?>

<root>
<texte>Bonjour le monde</texte>
<rire>Hahahahaha !!!</rire>
</root>

___________________
File2 : xmltest.xsl
___________________

<?xml version="1.0"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"
doctype-system="http://www.w3.org/TR/2000/03/WD-SVG-20000303/DTD/svg-20000303-stylable.dtd"/>
<xsl:template match="root">

<svg width="500" height="200">
<rect id="bkgrnd" x="0" y="0" width="400" height="80"
style="fill:lightgreen"/>
<text id="message" x="250" y="30" transform="matrix( 1
0 0 1 0 0 )" 
style="text-anchor:middle;font-size:24;font-family:Arial;font-weight:normal;font-style:normal;fill:red"><xsl:value-of
select="texte"/></text>
<text id="message1" x="280" y="60" transform="matrix(
1 0 0 1 0 0 )" 
style="text-anchor:middle;font-size:20;font-family:Arial;font-weight:normal;font-style:normal;fill:red"><xsl:value-of
select="rire"/></text>
</svg>
</xsl:template>
</xsl:stylesheet>

Bye !
Benjamin

___________________________________________________________
Do You Yahoo!? -- Pour faire vos courses sur le Net, 
Yahoo! Shopping : http://fr.shopping.yahoo.com

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: Cocoon, XML and SVG !

Posted by Sylvain Wallez <sy...@anyware-tech.com>.

benjamin pignier a écrit :
> 
> Hi !
> 
> I am using Cocoon 1.8.2, SVG Viewer 2.0 Beta and IE
> 5.5
> 
> I'm working on a project running with Cocoon, SVG and
> XML.
> In fact, I'm trying to create an SVG file with an XML
> and an XSL.
> The XML file contains all the informations I need to
> display inside.
> The XSL file succeed in transforming this file into
> SVG, reproducing correctly the information initially
> inside the XML file.
> 
> The problem is that Cocoon adds this heading on each
> new page containing SVG code :
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
> "http://www.w3.org/TR/REC-html40/strict.dtd">
> instead of just <?xml version="1.0"?> which is what we
> need to make our svg works correctly
> 
> Moreover, we tried and call the svg plugin thanks to
> the "<output...>" tag but this did not work
> 
> Please run these files in your browser with Cocoon and
> look :
> Thank you for your help !
> Benjamin
> ___________________
> File1 : xmltest.xml
> ___________________
> 
> <?xml version="1.0"?>
> <!DOCTYPE root [
>         <!ELEMENT root ANY>
>         <!ELEMENT texte ANY>
>         <!ELEMENT rire (#PCDATA)>
>         ]>
> 
> <?xml-stylesheet href="xmltest.xsl" type="text/xsl" ?>
> <?cocoon-process type="xslt"?>
> 
> <root>
> <texte>Bonjour le monde</texte>
> <rire>Hahahahaha !!!</rire>
> </root>
> 
> ___________________
> File2 : xmltest.xsl
> ___________________
> 
> <?xml version="1.0"?>
> <xsl:stylesheet
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <xsl:output method="xml" indent="yes"
> doctype-system="http://www.w3.org/TR/2000/03/WD-SVG-20000303/DTD/svg-20000303-stylable.dtd"/>
> <xsl:template match="root">
> 
> <svg width="500" height="200">
> <rect id="bkgrnd" x="0" y="0" width="400" height="80"
> style="fill:lightgreen"/>
> <text id="message" x="250" y="30" transform="matrix( 1
> 0 0 1 0 0 )"
> style="text-anchor:middle;font-size:24;font-family:Arial;font-weight:normal;font-style:normal;fill:red"><xsl:value-of
> select="texte"/></text>
> <text id="message1" x="280" y="60" transform="matrix(
> 1 0 0 1 0 0 )"
> style="text-anchor:middle;font-size:20;font-family:Arial;font-weight:normal;font-style:normal;fill:red"><xsl:value-of
> select="rire"/></text>
> </svg>
> </xsl:template>
> </xsl:stylesheet>
> 
> Bye !
> Benjamin
> 

xsl:output is ignored by Cocoon1 : it's the role of the Formatter, and
the default formatter outputs HTML.
Try adding <?cocoon-format type="text/xml"?> in xmltest.xml to force xml
output.

BTW, Adobe's SVG view is no more in beta, and I suggest you to consider
Cocoon2. I use it a lot for serving dynamic SVG.
-- 
Sylvain Wallez
Anyware Technologies - http://www.anyware-tech.com

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>