cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matt Robinson" <>
Subject Ways to implement Dynamic XSLT in Cocoon
Date Thu, 20 Jan 2005 03:48:54 GMT

Has anyone come across or written an transformer-based way to dynamically modify an XSLT template
at processing time?

My challenge is this:

To facilitate Web Metric analysis, we need to embed vendor-supplied JAVA script in each page.
 This JAVA script (and/or vendor) may change over time, and I want to maintain separation
of concerns such that the business (as opposed to the Cocoon
Development Team) can make changes to the vendor and/or JAVA script content without requiring
changes to the site coding.

The JAVA script is very dynamic and may include page-specific code that makes use of data
embedded in the page, as well as common variables.  In short, we cannot include the script
in the XSLT directly because of it's dynamic nature and the lack of XSLT
knowledge in the business.

I would like to implement a strategy whereby the script for the entire site is encapsulated
in an XML file for each Web Metrics vendor, and a transformer uses this XML, coupled with
a Page ID to add a template to the XSLT stylesheet instance being
transformed by the Xalan SAX Parser at build time.  The page data to insert will be represented
as XPaths embedded within the extra XSLT template.

My investigations show that a good approach would be to make a copy of the TraxTransformer
and intercept the XSLT data before it is actually transformed, adding the template (which
has been added to the pipeline SAX events by my new
WebMetricsTransformer), and then passing a StringReader containing the new XSLT Source object
into the transform.

Any constructive comments would be greatly appreciated

Kind Regards,

Matt Robinson

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message