I tend to start by adding customized 'default templates'. Something like:

<template match="@*|text()|comment()|processing-instruction()">
  <copy-of select="."/>
</template>

<template match="*">
  <copy>
    <apply-templates select="@*" />
    <apply-templates select="node()" />
  </copy>
</template>

(or all kinds of variations to this theme..)

But for novices, starting with an empty template for each element is nice 
indeed... :)

Cheers,
Geert

Derek Hohls wrote:

FWIW, one of the best bits of advice I saw when starting
out with XSL was... start your stylesheet off by creating a blank template match for *every* tag in your input XML:


<xsl:template match="tagN"></xsl:template>

If you run this against your source, there should be no output;
after this start "filling in the blanks".. and then it's relatively
easy to see when errors or unexpected results occur (of
course you also need to be aware of when your input XML
changes tags... maybe best to also have a "standard input" against which you can test the stylesheet; that way you'll be
able to tell if the error is the stylesheet or something weird
in the 'new' XML).


HTH
Derek


[EMAIL PROTECTED] 2005/03/09 01:03:44 PM >>>

It worked. Incredible :-) Thank you very much. I guess I have to work
more on my XSL skills.


Weez

----- Original Message ----- From: "Geert Josten" <[EMAIL PROTECTED]>
To: <[email protected]>
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="//[EMAIL PROTECTED] = '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="[EMAIL PROTECTED]'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" <[EMAIL PROTECTED]>
To: <[email protected]>
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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]




--
[EMAIL PROTECTED] 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------

To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]




--
[EMAIL PROTECTED] 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]




-- [EMAIL PROTECTED] 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to