You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by WeeZard <we...@email.si> on 2005/03/08 15:04:25 UTC
XSLT Transformer -> SVG Serializer problem
When I try to serialize a SVG file to either a PNG, JPG or any other graphic
file, one of two things happen:
1. If I have
<map:match pattern="image.png">
<map:generate src="image.svg" type="file"/>
<map:serialize type="svg2png"/>
</map:match>
everything works OK and an image is displayed when image.png is requested
2. When I got
<map:match pattern="image.png">
<map:generate src="image.xml" type="file"/>
<map:transform src="xml2svg.xsl" type="xslt">
<map:serialize type="svg2png"/>
</map:match>
where svg produced by the xslt transformer is exactly the same as the one
in the file image.svg in the 1st example.
I get an error message which says:
org.apache.cocoon.ProcessingException: Error executing pipeline.:
java.lang.RuntimeException: org.w3c.dom.DOMException: The current node
(type: 9, name: #document) do not allow children of the given type (type: 3,
name: #text)
So if I use a transformer before calling the serializer, I get the above
mentioned error. Things that I've tried and produced the same error:
- calling serializer with parameters
<map:serialize mime-type="image/jpeg" type="svg2png">
<map:parameter name="doctype-public" value="-//W3C//DTD
SVG 1.0//EN"/>
<map:parameter name="doctype-system"
value="http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"/>
</map:serialize>
- changing the transformer to xslt-saxon
- made sure that svg file passed to the svg serializer is a correct and
valid xml file
Has anyone had the same experiences or had any success with the pipeline
FILE GENERATOR -> XSL TRANSFORMER -> SVG SERIALIZER ?
Thanks in advance
Matt
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: XSLT Transformer -> SVG Serializer problem
Posted by WeeZard <we...@email.si>.
It worked. Incredible :-) Thank you very much. I guess I have to work more
on my XSL skills.
Weez
----- Original Message -----
From: "Geert Josten" <Ge...@daidalos.nl>
To: <us...@cocoon.apache.org>
Sent: Wednesday, March 09, 2005 9:33 AM
Subject: Re: XSLT Transformer -> SVG Serializer problem
> Should this generate only _one_ svg? Better to change your root template
> to:
>
> <xsl:template match="/">
> <xsl:apply-templates select="//tag[@id = 'fldName']" />
> </xsl:template>
>
> This will prevent character data that occurs outside the specific 'tag'
> element to be discarded, if any. That might have been the trouble.
>
> A small sample of the input might be usefull too..
>
> Cheers,
> Geert
>
> WeeZard wrote:
>
>> XSL look like this:
>>
>> -------------------------------------------------------------------------------------
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <xsl:stylesheet version="1.0"
>> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>> xmlns:fo="http://www.w3.org/1999/XSL/Format">
>>
>> <xsl:param name="tag" />
>>
>> <xsl:template match="/">
>> <xsl:apply-templates mode="" />
>> </xsl:template>
>>
>> <xsl:template match="tag[@id='fldName']">
>>
>> <svg width="10cm" height="3cm" viewBox="0 0 1000 300"
>> xmlns="http://www.w3.org/2000/svg" version="1.1">
>> <desc>Example text01 - 'Hello, out there' in blue</desc>
>> <text x="250" y="150" font-family="Verdana" font-size="55"
>> fill="blue">Hello, out there</text>
>> <rect x="1" y="1" width="998" height="298" fill="none"
>> stroke="blue" stroke-width="2" />
>> </svg>
>>
>> </xsl:template>
>>
>> <xsl:template match="tag"></xsl:template>
>>
>> </xsl:stylesheet>
>>
>>
>> ----- Original Message ----- From: "Geert Josten"
>> <Ge...@daidalos.nl>
>> To: <us...@cocoon.apache.org>
>> Sent: Tuesday, March 08, 2005 3:37 PM
>> Subject: Re: XSLT Transformer -> SVG Serializer problem
>>
>>
>>> Probably a problem with your XSL. It might produce some SAX Characters
>>> event before the root element.
>>>
>>> Can you show us your root template of the xsl?
>>>
>>> Cheers,
>>> Geert
>>>
>>> WeeZard wrote:
>>>
>>>> When I try to serialize a SVG file to either a PNG, JPG or any other
>>>> graphic file, one of two things happen:
>>>>
>>>> 1. If I have
>>>> <map:match pattern="image.png">
>>>> <map:generate src="image.svg" type="file"/>
>>>> <map:serialize type="svg2png"/>
>>>> </map:match>
>>>>
>>>> everything works OK and an image is displayed when image.png is
>>>> requested
>>>>
>>>> 2. When I got
>>>> <map:match pattern="image.png">
>>>> <map:generate src="image.xml" type="file"/>
>>>> <map:transform src="xml2svg.xsl" type="xslt">
>>>> <map:serialize type="svg2png"/>
>>>> </map:match>
>>>>
>>>> where svg produced by the xslt transformer is exactly the same as the
>>>> one in the file image.svg in the 1st example.
>>>> I get an error message which says:
>>>>
>>>> org.apache.cocoon.ProcessingException: Error executing pipeline.:
>>>> java.lang.RuntimeException: org.w3c.dom.DOMException: The current node
>>>> (type: 9, name: #document) do not allow children of the given type
>>>> (type: 3, name: #text)
>>>>
>>>>
>>>> So if I use a transformer before calling the serializer, I get the
>>>> above mentioned error. Things that I've tried and produced the same
>>>> error:
>>>> - calling serializer with parameters
>>>> <map:serialize mime-type="image/jpeg" type="svg2png">
>>>> <map:parameter name="doctype-public"
>>>> value="-//W3C//DTD SVG 1.0//EN"/>
>>>> <map:parameter name="doctype-system"
>>>> value="http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"/>
>>>> </map:serialize>
>>>>
>>>> - changing the transformer to xslt-saxon
>>>> - made sure that svg file passed to the svg serializer is a correct and
>>>> valid xml file
>>>>
>>>> Has anyone had the same experiences or had any success with the
>>>> pipeline FILE GENERATOR -> XSL TRANSFORMER -> SVG SERIALIZER ?
>>>>
>>>> Thanks in advance
>>>> Matt
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>>>> For additional commands, e-mail: users-help@cocoon.apache.org
>>>>
>>>>
>>>>
>>>
>>> --
>>> Geert.Josten@Daidalos.nl
>>> IT-consultant at Daidalos BV, Zoetermeer (NL)
>>>
>>> http://www.daidalos.nl/
>>> tel:+31-(0)79-3316961
>>> fax:+31-(0)79-3316464
>>>
>>> GPG: 1024D/12DEBB50
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>>
>>
>
> --
> Geert.Josten@Daidalos.nl
> IT-consultant at Daidalos BV, Zoetermeer (NL)
>
> http://www.daidalos.nl/
> tel:+31-(0)79-3316961
> fax:+31-(0)79-3316464
>
> GPG: 1024D/12DEBB50
>
> ---------------------------------------------------------------------
> 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
Re: XSLT Transformer -> SVG Serializer problem
Posted by Geert Josten <Ge...@daidalos.nl>.
Should this generate only _one_ svg? Better to change your root template to:
<xsl:template match="/">
<xsl:apply-templates select="//tag[@id = 'fldName']" />
</xsl:template>
This will prevent character data that occurs outside the specific 'tag' element to be discarded, if
any. That might have been the trouble.
A small sample of the input might be usefull too..
Cheers,
Geert
WeeZard wrote:
> XSL look like this:
>
> -------------------------------------------------------------------------------------
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:fo="http://www.w3.org/1999/XSL/Format">
>
> <xsl:param name="tag" />
>
> <xsl:template match="/">
> <xsl:apply-templates mode="" />
> </xsl:template>
>
> <xsl:template match="tag[@id='fldName']">
>
> <svg width="10cm" height="3cm" viewBox="0 0 1000 300"
> xmlns="http://www.w3.org/2000/svg" version="1.1">
> <desc>Example text01 - 'Hello, out there' in blue</desc>
> <text x="250" y="150" font-family="Verdana" font-size="55"
> fill="blue">Hello, out there</text>
> <rect x="1" y="1" width="998" height="298" fill="none"
> stroke="blue" stroke-width="2" />
> </svg>
>
> </xsl:template>
>
> <xsl:template match="tag"></xsl:template>
>
> </xsl:stylesheet>
>
>
> ----- Original Message ----- From: "Geert Josten"
> <Ge...@daidalos.nl>
> To: <us...@cocoon.apache.org>
> Sent: Tuesday, March 08, 2005 3:37 PM
> Subject: Re: XSLT Transformer -> SVG Serializer problem
>
>
>> Probably a problem with your XSL. It might produce some SAX Characters
>> event before the root element.
>>
>> Can you show us your root template of the xsl?
>>
>> Cheers,
>> Geert
>>
>> WeeZard wrote:
>>
>>> When I try to serialize a SVG file to either a PNG, JPG or any other
>>> graphic file, one of two things happen:
>>>
>>> 1. If I have
>>> <map:match pattern="image.png">
>>> <map:generate src="image.svg" type="file"/>
>>> <map:serialize type="svg2png"/>
>>> </map:match>
>>>
>>> everything works OK and an image is displayed when image.png is
>>> requested
>>>
>>> 2. When I got
>>> <map:match pattern="image.png">
>>> <map:generate src="image.xml" type="file"/>
>>> <map:transform src="xml2svg.xsl" type="xslt">
>>> <map:serialize type="svg2png"/>
>>> </map:match>
>>>
>>> where svg produced by the xslt transformer is exactly the same as
>>> the one in the file image.svg in the 1st example.
>>> I get an error message which says:
>>>
>>> org.apache.cocoon.ProcessingException: Error executing pipeline.:
>>> java.lang.RuntimeException: org.w3c.dom.DOMException: The current
>>> node (type: 9, name: #document) do not allow children of the given
>>> type (type: 3, name: #text)
>>>
>>>
>>> So if I use a transformer before calling the serializer, I get the
>>> above mentioned error. Things that I've tried and produced the same
>>> error:
>>> - calling serializer with parameters
>>> <map:serialize mime-type="image/jpeg" type="svg2png">
>>> <map:parameter name="doctype-public"
>>> value="-//W3C//DTD SVG 1.0//EN"/>
>>> <map:parameter name="doctype-system"
>>> value="http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"/>
>>> </map:serialize>
>>>
>>> - changing the transformer to xslt-saxon
>>> - made sure that svg file passed to the svg serializer is a correct
>>> and valid xml file
>>>
>>> Has anyone had the same experiences or had any success with the
>>> pipeline FILE GENERATOR -> XSL TRANSFORMER -> SVG SERIALIZER ?
>>>
>>> Thanks in advance
>>> Matt
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>>> For additional commands, e-mail: users-help@cocoon.apache.org
>>>
>>>
>>>
>>
>> --
>> Geert.Josten@Daidalos.nl
>> IT-consultant at Daidalos BV, Zoetermeer (NL)
>>
>> http://www.daidalos.nl/
>> tel:+31-(0)79-3316961
>> fax:+31-(0)79-3316464
>>
>> GPG: 1024D/12DEBB50
>>
>> ---------------------------------------------------------------------
>> 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
>
>
>
--
Geert.Josten@Daidalos.nl
IT-consultant at Daidalos BV, Zoetermeer (NL)
http://www.daidalos.nl/
tel:+31-(0)79-3316961
fax:+31-(0)79-3316464
GPG: 1024D/12DEBB50
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: XSLT Transformer -> SVG Serializer problem
Posted by WeeZard <we...@email.si>.
XSL look like this:
-------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:param name="tag" />
<xsl:template match="/">
<xsl:apply-templates mode="" />
</xsl:template>
<xsl:template match="tag[@id='fldName']">
<svg width="10cm" height="3cm" viewBox="0 0 1000 300"
xmlns="http://www.w3.org/2000/svg" version="1.1">
<desc>Example text01 - 'Hello, out there' in blue</desc>
<text x="250" y="150" font-family="Verdana" font-size="55"
fill="blue">Hello, out there</text>
<rect x="1" y="1" width="998" height="298" fill="none"
stroke="blue" stroke-width="2" />
</svg>
</xsl:template>
<xsl:template match="tag"></xsl:template>
</xsl:stylesheet>
----- Original Message -----
From: "Geert Josten" <Ge...@daidalos.nl>
To: <us...@cocoon.apache.org>
Sent: Tuesday, March 08, 2005 3:37 PM
Subject: Re: XSLT Transformer -> SVG Serializer problem
> Probably a problem with your XSL. It might produce some SAX Characters
> event before the root element.
>
> Can you show us your root template of the xsl?
>
> Cheers,
> Geert
>
> WeeZard wrote:
>
>> When I try to serialize a SVG file to either a PNG, JPG or any other
>> graphic file, one of two things happen:
>>
>> 1. If I have
>> <map:match pattern="image.png">
>> <map:generate src="image.svg" type="file"/>
>> <map:serialize type="svg2png"/>
>> </map:match>
>>
>> everything works OK and an image is displayed when image.png is
>> requested
>>
>> 2. When I got
>> <map:match pattern="image.png">
>> <map:generate src="image.xml" type="file"/>
>> <map:transform src="xml2svg.xsl" type="xslt">
>> <map:serialize type="svg2png"/>
>> </map:match>
>>
>> where svg produced by the xslt transformer is exactly the same as the
>> one in the file image.svg in the 1st example.
>> I get an error message which says:
>>
>> org.apache.cocoon.ProcessingException: Error executing pipeline.:
>> java.lang.RuntimeException: org.w3c.dom.DOMException: The current node
>> (type: 9, name: #document) do not allow children of the given type (type:
>> 3, name: #text)
>>
>>
>> So if I use a transformer before calling the serializer, I get the above
>> mentioned error. Things that I've tried and produced the same error:
>> - calling serializer with parameters
>> <map:serialize mime-type="image/jpeg" type="svg2png">
>> <map:parameter name="doctype-public"
>> value="-//W3C//DTD SVG 1.0//EN"/>
>> <map:parameter name="doctype-system"
>> value="http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"/>
>> </map:serialize>
>>
>> - changing the transformer to xslt-saxon
>> - made sure that svg file passed to the svg serializer is a correct and
>> valid xml file
>>
>> Has anyone had the same experiences or had any success with the pipeline
>> FILE GENERATOR -> XSL TRANSFORMER -> SVG SERIALIZER ?
>>
>> Thanks in advance
>> Matt
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
>>
>>
>>
>
> --
> Geert.Josten@Daidalos.nl
> IT-consultant at Daidalos BV, Zoetermeer (NL)
>
> http://www.daidalos.nl/
> tel:+31-(0)79-3316961
> fax:+31-(0)79-3316464
>
> GPG: 1024D/12DEBB50
>
> ---------------------------------------------------------------------
> 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
Re: XSLT Transformer -> SVG Serializer problem
Posted by Geert Josten <Ge...@daidalos.nl>.
Probably a problem with your XSL. It might produce some SAX Characters event before the root element.
Can you show us your root template of the xsl?
Cheers,
Geert
WeeZard wrote:
> When I try to serialize a SVG file to either a PNG, JPG or any other
> graphic file, one of two things happen:
>
> 1. If I have
> <map:match pattern="image.png">
> <map:generate src="image.svg" type="file"/>
> <map:serialize type="svg2png"/>
> </map:match>
>
> everything works OK and an image is displayed when image.png is requested
>
> 2. When I got
> <map:match pattern="image.png">
> <map:generate src="image.xml" type="file"/>
> <map:transform src="xml2svg.xsl" type="xslt">
> <map:serialize type="svg2png"/>
> </map:match>
>
> where svg produced by the xslt transformer is exactly the same as the
> one in the file image.svg in the 1st example.
> I get an error message which says:
>
> org.apache.cocoon.ProcessingException: Error executing pipeline.:
> java.lang.RuntimeException: org.w3c.dom.DOMException: The current node
> (type: 9, name: #document) do not allow children of the given type
> (type: 3, name: #text)
>
>
> So if I use a transformer before calling the serializer, I get the above
> mentioned error. Things that I've tried and produced the same error:
> - calling serializer with parameters
> <map:serialize mime-type="image/jpeg" type="svg2png">
> <map:parameter name="doctype-public"
> value="-//W3C//DTD SVG 1.0//EN"/>
> <map:parameter name="doctype-system"
> value="http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"/>
> </map:serialize>
>
> - changing the transformer to xslt-saxon
> - made sure that svg file passed to the svg serializer is a correct and
> valid xml file
>
> Has anyone had the same experiences or had any success with the pipeline
> FILE GENERATOR -> XSL TRANSFORMER -> SVG SERIALIZER ?
>
> Thanks in advance
> Matt
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
>
--
Geert.Josten@Daidalos.nl
IT-consultant at Daidalos BV, Zoetermeer (NL)
http://www.daidalos.nl/
tel:+31-(0)79-3316961
fax:+31-(0)79-3316464
GPG: 1024D/12DEBB50
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org