cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Derek Hohls" <DHo...@csir.co.za>
Subject Re: XSLT Transformer -> SVG Serializer problem
Date Wed, 09 Mar 2005 08:46:13 GMT
Geert

This works on the files I have been testing... obvious once you see it
as any other tags are then ignored.

Maybe to ensure only one 'svg', use:

<xsl:template match="/">
<svg>
 <xsl:apply-templates select="//tag[@id = 'fldName']" />
<svg>
</xsl:template>

<xsl:template match="tag[@id='fldName']">
  <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" />
</xsl:template>

Derek

>>> Geert.Josten@daidalos.nl 2005/03/09 10:33:21 AM >>>
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" 
> <Geert.Josten@daidalos.nl>
> To: <users@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


Mime
View raw message