You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by "Christofer.Dutz@univativ.de" <ch...@univativ.de> on 2006/10/04 16:48:31 UTC
[CForms] Bugfix for broken SuggestionList Widget in CVS version of Cocoon 2.1.x
Hi,
I am currently updating to the CVS version of Cocoon and found out that my suggestion-lists no longer worked. I did a normal build of cocoon and tried out the sample for suggestion-lists and that didn't work either. I compared the output of the suggestion-list pipeline to the sample files shipped in the dojo test folder and saw that they don't have a trailing ";". After removing this, the samples and my version worked again without any problems. Maybe it would be good to update the selection-list2json.xsl or to update the Suggestion-List CForms widget code if this would result in breaking other parts.
Here my updated file:
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!--
Transforms a fi:selection-list into a JSON fragment.
@version $Id: selection-list2json.xsl 449149 2006-09-23 03:58:05Z crossley $
-->
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fi="http://apache.org/cocoon/forms/1.0#instance">
<xsl:template match="fi:selection-list">
<dummy-root>
<xsl:text>[ </xsl:text>
<xsl:apply-templates/>
<xsl:text> ]</xsl:text>
</dummy-root>
</xsl:template>
<xsl:template match="fi:item">
<xsl:text>["</xsl:text>
<!-- displayed text -->
<xsl:choose>
<xsl:when test="fi:label">
<xsl:value-of select="fi:label"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@value"/>
</xsl:otherwise>
</xsl:choose>
<xsl:text>", "</xsl:text>
<!-- value -->
<xsl:value-of select="@value"/>
<xsl:text>"]</xsl:text>
<xsl:if test="position() != last()">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
Regards,
Chris
[ c h r i s t o f e r d u t z ]
IT-Berater
univativ GmbH & Co. KG
Robert-Bosch-Str. 7, 64293 Darmstadt
fon: 0 61 51 / 66 717 - 21
fax: 0 61 51 / 66 717 - 29
email: christofer.dutz@univativ.de
http://www.univativ.de
Darmstadt, Stuttgart, Karlsruhe, Düsseldorf
Re: [CForms] Bugfix for broken SuggestionList Widget in CVS version
of Cocoon 2.1.x
Posted by Antonio Gallardo <ag...@agssa.net>.
Hi Christopher:
Would you send a patch, please. I will be glad to commit it.
Best Regards,
Antonio Gallardo.
Christofer.Dutz@univativ.de escribió:
>
> Hi,
>
> I am currently updating to the CVS version of Cocoon and found out
> that my suggestion-lists no longer worked. I did a normal build of
> cocoon and tried out the sample for suggestion-lists and that didn’t
> work either. I compared the output of the suggestion-list pipeline to
> the sample files shipped in the dojo test folder and saw that they
> don’t have a trailing “;”. After removing this, the samples and my
> version worked again without any problems. Maybe it would be good to
> update the selection-list2json.xsl or to update the Suggestion-List
> CForms widget code if this would result in breaking other parts.
>
> Here my updated file:
>
> <?xml version="1.0"?>
>
> <!--
>
> Licensed to the Apache Software Foundation (ASF) under one or more
>
> contributor license agreements. See the NOTICE file distributed with
>
> this work for additional information regarding copyright ownership.
>
> The ASF licenses this file to You under the Apache License, Version 2.0
>
> (the "License"); you may not use this file except in compliance with
>
> the License. You may obtain a copy of the License at
>
> http://www.apache.org/licenses/LICENSE-2.0
>
> Unless required by applicable law or agreed to in writing, software
>
> distributed under the License is distributed on an "AS IS" BASIS,
>
> WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
>
> See the License for the specific language governing permissions and
>
> limitations under the License.
>
> -->
>
> <!--
>
> Transforms a fi:selection-list into a JSON fragment.
>
> @version $Id: selection-list2json.xsl 449149 2006-09-23 03:58:05Z
> crossley $
>
> -->
>
> <xsl:stylesheet
>
> version="1.0"
>
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>
> xmlns:fi="http://apache.org/cocoon/forms/1.0#instance">
>
> <xsl:template match="fi:selection-list">
>
> <dummy-root>
>
> <xsl:text>[ </xsl:text>
>
> <xsl:apply-templates/>
>
> <xsl:text> ]</xsl:text>
>
> </dummy-root>
>
> </xsl:template>
>
> <xsl:template match="fi:item">
>
> <xsl:text>["</xsl:text>
>
> <!-- displayed text -->
>
> <xsl:choose>
>
> <xsl:when test="fi:label">
>
> <xsl:value-of select="fi:label"/>
>
> </xsl:when>
>
> <xsl:otherwise>
>
> <xsl:value-of select="@value"/>
>
> </xsl:otherwise>
>
> </xsl:choose>
>
> <xsl:text>", "</xsl:text>
>
> <!-- value -->
>
> <xsl:value-of select="@value"/>
>
> <xsl:text>"]</xsl:text>
>
> <xsl:if test="position() != last()">
>
> <xsl:text>, </xsl:text>
>
> </xsl:if>
>
> </xsl:template>
>
> </xsl:stylesheet>
>
> Regards,
>
> Chris
>
> [ c h r i s t o f e r d u t z ]
>
> IT-Berater
>
> univativ GmbH & Co. KG
>
> Robert-Bosch-Str. 7, 64293 Darmstadt
>
> fon: 0 61 51 / 66 717 - 21
>
> fax: 0 61 51 / 66 717 - 29
>
> email: christofer.dutz@univativ.de
>
> http://www.univativ.de
>
> Darmstadt, Stuttgart, Karlsruhe, Düsseldorf
>