Christoph Hermann wrote:

Am Sonntag, 2. Oktober 2005 21:04 schrieb Sandor Spruit:

Hello,
Don't know about the best way, but I had a similar problem recently:
I wanted to apply a transformation to specific elements, pointed to by
an XPath expression. The basic problem was that XSLT will not allow
a variable where it expects an XPath, i.e. xsl:template match="$xpath".

One of our students came up with this idea: create the *stylesheet* in a
separate (internal) Cocoon pipeline. Create a placeholder in your XSLT
where you'd normally insert an XPath expression, i.e. 'please-replace-me',
and define a variable for this stylesheet. Write a simple stylesheet to
copy the "stylesheet" template, but replacing the placeholder with your
XPath.

Use the result of this pipeline ('a dynamic stylesheet') from your regular
Cocoon pipeline using the cocoon:/ pseudo-protocol.

Wouldn't it be _much_ easier to use xalan extensions for this purpose?

<xsl:stylesheet version="1.0"
       xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
       xmlns:xalan="http://xml.apache.org/xalan";>
 <xsl:param name="parameter_xpath"/>
...
... select="xalan:evaluate($parameter_xpath)"

I was hoping for a reply like this - even though a dynamic stylesheet
seemed to be a smart move :) I'll give it a try this afternoon.

cheers,
Sandor

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

Reply via email to