You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Lincoln <li...@oracle.com> on 2006/01/06 06:17:30 UTC

Chaining transforms in SourceWritingTransformer?

Can I chain another transform to my SourceWritingTransformer sitemap
pipeline?
I imagine it would look like this. But the resulting png is not effected by
"another.xsl".
---
<map:pipeline>
  <map:match pattern="write/**">
    <map:generate type="request"/>
    <map:transform src="request2doc.xsl"/>
    <map:transform src="doc2write.xsl"/>
    <map:transform type="xinclude"/>

    <!--Added transform->
    <map:transform src="another.xsl"/>

    <map:transform type="write-source">
	<map:parameter name="serializer" value="svg2png"/>
    </map:transform>
    <map:serialize type="xml"/>
  </map:match>
</map:pipeline>
---


Any pointers?

TIA
Linc



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


RE: Chaining transforms in SourceWritingTransformer?

Posted by Lincoln <li...@oracle.com>.
Just incase anyone was keen to know the solution to this thread.
It was just a namespace issue. I had to change the namespace on SVG tag on
the original "rect.svg" from the default xmlns namespace to  xmlns:svg.

Thanks to Jason Johnston for the help.

Linc

> -----Original Message-----
> From: Lincoln [mailto:lincoln.mitchell@oracle.com]
> Sent: Friday, January 06, 2006 1:39 PM
> To: users@cocoon.apache.org
> Subject: RE: Chaining transforms in SourceWritingTransformer?
> 
> 
> Here's Another.xsl
> ---
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>   <xsl:template match="/">
>     <xsl:apply-templates/>
>   </xsl:template>
>   <xsl:template match="//g[@id='myRect']">
>     <xsl:copy>
>       <xsl:apply-templates select="@*|node()"/>
>       <rect  x="0" y="0" width="20" height="20" fill="blue"/>
>     </xsl:copy>
>   </xsl:template>
>   <xsl:template match="@*|node()">
>     <xsl:copy>
>       <xsl:apply-templates select="@*|node()"/>
>     </xsl:copy>
>   </xsl:template>
> </xsl:stylesheet>
> ---
> 
> And here's "rect.svg"
> ---
> <svg xmlns="http://www.w3.org/2000/svg" width="100" height="100">
>   <g id="myRect">
>     <rect  width="165" height="126" fill="green"/>
>   </g>
> </svg>
> ---
> 
> 
> 
> > -----Original Message-----
> > From: Jason Johnston [mailto:cocoon@lojjic.net]
> > Sent: Friday, January 06, 2006 1:24 PM
> > To: users@cocoon.apache.org
> > Subject: Re: Chaining transforms in SourceWritingTransformer?
> >
> > Lincoln wrote:
> > > Can I chain another transform to my SourceWritingTransformer sitemap
> > > pipeline?
> >
> > Yes, you can add as many transformers as you like in any order.  This is
> > the whole idea behind pipelines! :-)
> >
> > > I imagine it would look like this. But the resulting png is not
> effected
> > by
> > > "another.xsl".
> >
> > Without knowing what is in another.xsl I can't help much.  But you
> > should be able to do this.
> >
> > To help debugging, you can temporarily remove the write-source transform
> > stage to see what XML it is getting before and after you add another.xsl
> > in the mix, so you can verify that another.xsl is working properly.
> >
> > > ---
> > > <map:pipeline>
> > >   <map:match pattern="write/**">
> > >     <map:generate type="request"/>
> > >     <map:transform src="request2doc.xsl"/>
> > >     <map:transform src="doc2write.xsl"/>
> > >     <map:transform type="xinclude"/>
> > >
> > >     <!--Added transform->
> > >     <map:transform src="another.xsl"/>
> > >
> > >     <map:transform type="write-source">
> > > 	<map:parameter name="serializer" value="svg2png"/>
> > >     </map:transform>
> > >     <map:serialize type="xml"/>
> > >   </map:match>
> > > </map:pipeline>
> > > ---
> >
> > ---------------------------------------------------------------------
> > 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




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


RE: Chaining transforms in SourceWritingTransformer?

Posted by Lincoln <li...@oracle.com>.
Here's Another.xsl
---
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:template match="/">
    <xsl:apply-templates/>
  </xsl:template>
  <xsl:template match="//g[@id='myRect']">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()"/>
      <rect  x="0" y="0" width="20" height="20" fill="blue"/>
    </xsl:copy>
  </xsl:template>
  <xsl:template match="@*|node()">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
  </xsl:template>
</xsl:stylesheet>
---

And here's "rect.svg"
---
<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100">
  <g id="myRect">
    <rect  width="165" height="126" fill="green"/>
  </g>
</svg>
---



> -----Original Message-----
> From: Jason Johnston [mailto:cocoon@lojjic.net]
> Sent: Friday, January 06, 2006 1:24 PM
> To: users@cocoon.apache.org
> Subject: Re: Chaining transforms in SourceWritingTransformer?
> 
> Lincoln wrote:
> > Can I chain another transform to my SourceWritingTransformer sitemap
> > pipeline?
> 
> Yes, you can add as many transformers as you like in any order.  This is
> the whole idea behind pipelines! :-)
> 
> > I imagine it would look like this. But the resulting png is not effected
> by
> > "another.xsl".
> 
> Without knowing what is in another.xsl I can't help much.  But you
> should be able to do this.
> 
> To help debugging, you can temporarily remove the write-source transform
> stage to see what XML it is getting before and after you add another.xsl
> in the mix, so you can verify that another.xsl is working properly.
> 
> > ---
> > <map:pipeline>
> >   <map:match pattern="write/**">
> >     <map:generate type="request"/>
> >     <map:transform src="request2doc.xsl"/>
> >     <map:transform src="doc2write.xsl"/>
> >     <map:transform type="xinclude"/>
> >
> >     <!--Added transform->
> >     <map:transform src="another.xsl"/>
> >
> >     <map:transform type="write-source">
> > 	<map:parameter name="serializer" value="svg2png"/>
> >     </map:transform>
> >     <map:serialize type="xml"/>
> >   </map:match>
> > </map:pipeline>
> > ---
> 
> ---------------------------------------------------------------------
> 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: Chaining transforms in SourceWritingTransformer?

Posted by Jason Johnston <co...@lojjic.net>.
Lincoln wrote:
> Can I chain another transform to my SourceWritingTransformer sitemap
> pipeline?

Yes, you can add as many transformers as you like in any order.  This is 
the whole idea behind pipelines! :-)

> I imagine it would look like this. But the resulting png is not effected by
> "another.xsl".

Without knowing what is in another.xsl I can't help much.  But you 
should be able to do this.

To help debugging, you can temporarily remove the write-source transform 
stage to see what XML it is getting before and after you add another.xsl 
in the mix, so you can verify that another.xsl is working properly.

> ---
> <map:pipeline>
>   <map:match pattern="write/**">
>     <map:generate type="request"/>
>     <map:transform src="request2doc.xsl"/>
>     <map:transform src="doc2write.xsl"/>
>     <map:transform type="xinclude"/>
> 
>     <!--Added transform->
>     <map:transform src="another.xsl"/>
> 
>     <map:transform type="write-source">
> 	<map:parameter name="serializer" value="svg2png"/>
>     </map:transform>
>     <map:serialize type="xml"/>
>   </map:match>
> </map:pipeline>
> ---

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