Hi,

I appologise in advance for posting to this mailing list, but I also think
that the answer maybe of interest to the Cocoon community.

What I am trying to do is to build a generic form within C2 that is defined
in an XSP which is aggregated with another path that will contain the data
which is to be plugged into the form, thereby allowing for improved form
(UI) reuse across scenarios. In trying to do this, I need the ability to
perform run-time XPath evaluation, rather than at programming time.

I have found a Xalan extension function (luckily before I wanted to write my
own :) that appears to do the trick. Its called "xalan:evaluate()" and takes
an XPath expression as a parameter, which in turn contains an XPath
expression, which is then evaluated and returned.

I've read the docs, but can't get it to work. The docs say to use the
namespace   xmlns:xalan="http://xml.apache.org/xalan";. I'm calling the
extension function in my xml2html transformation stylesheet as follows:

<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
  xmlns:xalan="http://xml.apache.org/xalan";
  xmlns:zdam="zenark.com/zdam"
  exclude-result-prefixes="xalan"
>

<xsl:template ...>

...
        <xsl:choose>
          <xsl:when test="@bind-to">
            <xsl:attribute name="value"><xsl:value-of
select="xalan:evaluate(@bind-to)"/></xsl:attribute>
            </xsl:when>
          <xsl:otherwise><xsl:attribute name="value"><xsl:value-of
select="normalize-space()"/></xsl:attribute></xsl:otherwise>
        </xsl:choose>
...

</xsl:template>

</xsl:stylesheet>

The problem is that evaluate() returns '', rather than the expected real
value. The returned XPath expression (in @bind-to) is correct.

Any thoughts or experiences?
Thanks in advance,
Adrian



---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

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

Reply via email to