Hi,
I've got an xsl that is doing the styling, depending of the kind of widget:
<xsl:for-each select="fi:widgets/*">
<xsl:choose>
<xsl:when test="local-name(.) = 'field'">
<dothis/>
</xsl:when>
<xsl:when test="local-name(.) = 'submit'">
<dothat/>
</xsl:when>
...
Somehow the <xsl:when test="local-name(.) = 'submit'"> doesn't work.
Field widgets are "found", but submit-widgets aren't.
The forms definition-file:
...
<fd:field id="username" required="true">
<fd:label>Username:</fd:label>
<fd:datatype base="string"/>
</fd:field>
<fd:submit id="login" required="false">
<fd:label>Login</fd:label>
</fd:submit>
The forms template-file:
...
<fi:group>
<fi:widgets>
<ft:widget id="username">
<fi:styling size="20"/>
</ft:widget>
<ft:widget id="login"/>
</fi:widgets>
</fi:group>
Somehow I couldn't spot the error. Any idea what I'm doing wrong?
Cheers
Jonny
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: submit - How to access from xsl?
Posted by Johannes Becker <jo...@gmx.net>.
Hi,
Thanks for the quick response. Unfortunately this didn't help. I found out that the
local-name() for this widget returns "action" (since its an action-widget).
Is there another way to compare the widgets?
>> By the way: why are you using for-each and choose/when? XSLT is invented
>> to do this for you. You simple write template matchers for every element
>> you want to be visited...
This was copied from some other projekt (CHS). Never thought about it, but I will now.
Cheers
Jonny
Kees Broenink wrote:
>Hi Johannes,
>
>I have had similar problems. I found this in my code:
> <!-- if was difficult to get local-name() returning the name;
>worked only with a variable with value-of in the body -->
> <xslt:template match="*">
> <xslt:variable name="el"><xslt:value-of
>select="local-name()"/></xslt:variable>
> <xslt:element name="{$el}" namespace="{$namespace}">
> <xslt:copy-of select="@*"/>
> <xslt:value-of select="text()"/>
> <xslt:apply-templates/>
> </xslt:element>
> </xslt:template>
>
>By the way: why are you using for-each and choose/when? XSLT is invented
>to do this for you. You simple write template matchers for every element
>you want to be visited...
>
>Hope this helps,
>
>Kees
>
>
>
>-----Oorspronkelijk bericht-----
>Van: Johannes Becker [mailto:jonnybecker@gmx.net]
>Verzonden: Tuesday, June 14, 2005 4:22 PM
>Aan: users@cocoon.apache.org
>Onderwerp: <fd:submit - How to access from xsl?
>
>
>Hi,
>
>I've got an xsl that is doing the styling, depending of the kind of
>widget:
>
><xsl:for-each select="fi:widgets/*">
> <xsl:choose>
> <xsl:when test="local-name(.) = 'field'">
> <dothis/>
> </xsl:when>
> <xsl:when test="local-name(.) = 'submit'">
> <dothat/>
> </xsl:when>
> ...
>
>Somehow the <xsl:when test="local-name(.) = 'submit'"> doesn't work.
>Field widgets are "found", but submit-widgets aren't.
>
>The forms definition-file:
>...
><fd:field id="username" required="true">
> <fd:label>Username:</fd:label>
> <fd:datatype base="string"/>
></fd:field>
><fd:submit id="login" required="false">
> <fd:label>Login</fd:label>
></fd:submit>
>
>The forms template-file:
>...
><fi:group>
> <fi:widgets>
> <ft:widget id="username">
> <fi:styling size="20"/>
> </ft:widget>
> <ft:widget id="login"/>
> </fi:widgets>
></fi:group>
>
>Somehow I couldn't spot the error. Any idea what I'm doing wrong?
>
>Cheers
>Jonny
>
>---------------------------------------------------------------------
>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
RE: submit - How to access from xsl?
Posted by Kees Broenink <ke...@backbase.com>.
Hi Johannes,
I have had similar problems. I found this in my code:
<!-- if was difficult to get local-name() returning the name;
worked only with a variable with value-of in the body -->
<xslt:template match="*">
<xslt:variable name="el"><xslt:value-of
select="local-name()"/></xslt:variable>
<xslt:element name="{$el}" namespace="{$namespace}">
<xslt:copy-of select="@*"/>
<xslt:value-of select="text()"/>
<xslt:apply-templates/>
</xslt:element>
</xslt:template>
By the way: why are you using for-each and choose/when? XSLT is invented
to do this for you. You simple write template matchers for every element
you want to be visited...
Hope this helps,
Kees
-----Oorspronkelijk bericht-----
Van: Johannes Becker [mailto:jonnybecker@gmx.net]
Verzonden: Tuesday, June 14, 2005 4:22 PM
Aan: users@cocoon.apache.org
Onderwerp: <fd:submit - How to access from xsl?
Hi,
I've got an xsl that is doing the styling, depending of the kind of
widget:
<xsl:for-each select="fi:widgets/*">
<xsl:choose>
<xsl:when test="local-name(.) = 'field'">
<dothis/>
</xsl:when>
<xsl:when test="local-name(.) = 'submit'">
<dothat/>
</xsl:when>
...
Somehow the <xsl:when test="local-name(.) = 'submit'"> doesn't work.
Field widgets are "found", but submit-widgets aren't.
The forms definition-file:
...
<fd:field id="username" required="true">
<fd:label>Username:</fd:label>
<fd:datatype base="string"/>
</fd:field>
<fd:submit id="login" required="false">
<fd:label>Login</fd:label>
</fd:submit>
The forms template-file:
...
<fi:group>
<fi:widgets>
<ft:widget id="username">
<fi:styling size="20"/>
</ft:widget>
<ft:widget id="login"/>
</fi:widgets>
</fi:group>
Somehow I couldn't spot the error. Any idea what I'm doing wrong?
Cheers
Jonny
---------------------------------------------------------------------
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