cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mansour Al Akeel <mansour.alak...@gmail.com>
Subject Re: using both Xalan and Saxon with C3
Date Fri, 07 Dec 2012 02:07:27 GMT
I see. Makes sense.
Thank you Greg !


On Thu, Dec 6, 2012 at 8:21 PM, gelo1234 <gelo1234@gmail.com> wrote:
>
> When you are paranoid;) about the performance, you can set many different
> configs for xslt processors.
>
> e.g. the one that uses compiled versions of XSL sheets - translets (XSLTC)
> http://xml.apache.org/xalan-j/xsltc_usage.html
> or the one that is faster because it doesn't use Request Parameters
> or the one that is reused between concurrent transformations (e.g. xalan can
> be used in this mode but it fails with very complex namespaces,
> the latest release of xalan handles it correctly though :)
> or the one that is the most robust but a bit slower (saxon?)
>
> And use whatever one you want in any match of pipeline.
>
> Greetings,
> -Greg
>
>
> 2012/12/7 Mansour Al Akeel <mansour.alakeel@gmail.com>
>>
>> Ok, I see what you mean now.
>>
>> Just out of curiosity, why would anyone need to use more than one xslt
>> processor in one application ??
>>
>> Thank you.
>>
>> On Thu, Dec 6, 2012 at 2:50 AM, Robby Pelssers <Robby.Pelssers@nxp.com>
>> wrote:
>> > You missed the point Mansour... I meant simultaneously in 1 pipeline.
>> >
>> > But thx for thinking along.
>> > Robby
>> >
>> > -----Original Message-----
>> > From: Mansour Al Akeel [mailto:mansour.alakeel@gmail.com]
>> > Sent: Thursday, December 06, 2012 5:00 AM
>> > To: users@cocoon.apache.org
>> > Cc: dev@cocoon.apache.org
>> > Subject: Re: using both Xalan and Saxon with C3
>> >
>> > If I am not wrong, you can always change the implementation for the xslt
>> > processor in the final WAR file by setting:
>> >
>> > META-INF/services/javax.xml.transform.TransformerFactory
>> >
>> > This is simple and clean.
>> >
>> >
>> >
>> > On Wed, Dec 5, 2012 at 5:21 AM, Robby Pelssers <Robby.Pelssers@nxp.com>
>> > wrote:
>> >> I did some investigation into this matter and the problem is in
>> >> org.apache.cocoon.sax.component.XSLTTransformer
>> >>
>> >> It has two constructor methods:
>> >>
>> >>     public XSLTTransformer(final URL source) {
>> >>         this(source, null);
>> >>     }
>> >>
>> >> And
>> >>
>> >>     public XSLTTransformer(final URL source, final Map<String, Object>
>> >> attributes) {
>> >>         super();
>> >>         this.loadXSLT(source, attributes);
>> >>     }
>> >>
>> >> So we can set attributes for the transformerfactory but not choose the
>> >> implementation. First of all I see something in the code that makes no sense
>> >> to me:
>> >>
>> >>     /**
>> >>      * A generic transformer factory to parse XSLTs.
>> >>      */
>> >>     private static final SAXTransformerFactory TRAX_FACTORY =
>> >> createNewSAXTransformerFactory();
>> >>
>> >> this always falls back to
>> >>
>> >>     private static SAXTransformerFactory
>> >> createNewSAXTransformerFactory() {
>> >>         return (SAXTransformerFactory)
>> >> TransformerFactory.newInstance();
>> >>     }
>> >>
>> >>
>> >> But on lines 148 to 157 I see following code.  If the attributes are
>> >> not null and not empty we STILL use createNewSAXTransformerFactory.  So
the
>> >> else block seems like a complete waste here?!
>> >>
>> >>
>> >>             // XSLT has to be parsed
>> >>             SAXTransformerFactory transformerFactory;
>> >>             if (attributes != null && !attributes.isEmpty()) {
>> >>                 transformerFactory = createNewSAXTransformerFactory();
>> >>                 for (Entry<String, Object> attribute :
>> >> attributes.entrySet()) {
>> >>                     transformerFactory.setAttribute(attribute.getKey(),
>> >> attribute.getValue());
>> >>                 }
>> >>             } else {
>> >>                 transformerFactory = TRAX_FACTORY;
>> >>             }
>> >>
>> >> Ideally I would like to see a third constructor method which would
>> >> allow us to set  the factoryClassName of the
>> >> Javax.xml.transform.TransformerFactory
>> >>
>> >> And default use:
>> >>
>> >> public static TransformerFactory newInstance(String factoryClassName,
>> >> ClassLoader classLoader)  throws TransformerFactoryConfigurationError
>> >>
>> >> We could from Cocoon side default set this to be
>> >> "com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl" if
the
>> >> factoryClassName is null or empty.
>> >>
>> >> Just thinking out loud here...
>> >>
>> >> Robby
>> >>
>> >>
>> >> -----Original Message-----
>> >> From: Robby Pelssers [mailto:Robby.Pelssers@nxp.com]
>> >> Sent: Tuesday, December 04, 2012 2:21 PM
>> >> To: dev@cocoon.apache.org; users@cocoon.apache.org
>> >> Subject: using both Xalan and Saxon with C3
>> >>
>> >> Hi guys,
>> >>
>> >> Just wondering how I would configure a C3 project so I could use both
>> >> Xalan and Saxon from my sitemap and java
>> >>
>> >> I currently took the approach to just create a file
>> >> META-INF/services/javax.xml.transform.TransformerFactory
>> >> With following content:
>> >> net.sf.saxon.TransformerFactoryImpl
>> >>
>> >> But I guess that restricts me to always use Saxon by default?
>> >>
>> >> Robby
>> >>
>> >> ---------------------------------------------------------------------
>> >> 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
>> >
>>
>> ---------------------------------------------------------------------
>> 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