You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Adrian Geissel <ag...@zenark.com> on 2001/10/19 10:34:00 UTC

[C2.0rc1] SLIGHTLY OFF TOPIC: Has anyone used Xalan extensions in Cocoon?

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: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: [C2.0rc1] SLIGHTLY OFF TOPIC: Has anyone used Xalan extensions in Cocoon?

Posted by Adrian Geissel <ag...@zenark.com>.
Oops - it's just a little too early on a Friday morning!

I 've spotted the error - the XPath expression was technically correct, but
the test data was not correctly Generated - thus it did not exist for the
transformer.

However, I hope that this approach may thus be of benefit to someone else,
albeit Xalan specific.
Regards,
Adrian

----- Original Message -----
From: Adrian Geissel <ag...@zenark.com>
To: <co...@xml.apache.org>
Sent: Friday, October 19, 2001 9:34 AM
Subject: [C2.0rc1] SLIGHTLY OFF TOPIC: Has anyone used Xalan extensions in
Cocoon?


> 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: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>
>
>



---------------------------------------------------------------------
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: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


RE: [C2.0rc1] SLIGHTLY OFF TOPIC: Has anyone used Xalan extensions in Cocoon?

Posted by Torsten Curdt <tc...@dff.st>.
Have a look into exformula at sourceforge the xform2html.xsl
uses it.
--
Torsten

> -----Original Message-----
> From: Adrian Geissel [mailto:ageissel@zenark.com]
> Sent: Friday, October 19, 2001 10:34 AM
> To: cocoon-users@xml.apache.org
> Subject: [C2.0rc1] SLIGHTLY OFF TOPIC: Has anyone used Xalan extensions
> in Cocoon?
> 
> 
> 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: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>
> 
> 

---------------------------------------------------------------------
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: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


RE: [C2.0rc1] SLIGHTLY OFF TOPIC: Has anyone used Xalan extensions in Cocoon?

Posted by Max Larsson <ma...@gmservice.de>.
Hi

as long as i knwo you forgotten to define that the
namespace xalan is an extension namespace. How to do
that you have to read the Xalan documentation.

Max

-----Original Message-----
From: Adrian Geissel [mailto:ageissel@zenark.com]
Sent: Freitag, 19. Oktober 2001 10:34
To: cocoon-users@xml.apache.org
Subject: [C2.0rc1] SLIGHTLY OFF TOPIC: Has anyone used Xalan extensions
in Cocoon?


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: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>



---------------------------------------------------------------------
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: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>