cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Davanum Srinivas <d...@yahoo.com>
Subject Re: esql-patch: tag-name WITH attachment!
Date Wed, 05 Sep 2001 12:20:28 GMT
Team,

Can someone check if this patch works well? Then we can check it into C1.X, C2.0 & C2.1.

-- dims

--- Enke Michael <Michael.Enke@wincor-nixdorf.com> wrote:
> Enke Michael wrote:
> > 
> > Hi.
> > I had the problem that I have to receive rows from a table
> > where the number of columns is variable (because the query is
> > variabe). For this reason it is useful to have the element names
> > the same for each column.
> > I introduced the "tag-name" attribute in esql:get-columns.
> > 
> > E.g. <esql:get-columns tag-name="column"/> will result in
> > <column>
> >  col1
> > </column>
> > <column>
> >  col2
> > </column>
> > ...
> > 
> > ( Remark: the tag-case applies after this too.
> >   <esql:get-columns tag-name="column" tag-case="upper"/>
> >   results in <COLUMN>col1</COLUMN>... )
> > 
> > Could a commiter commit this please?
> > One question: If I get the dev-snapshot, which version do I get?
> > 2.0 or 2.1?
> > 
> > Regards,
> > Michael
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> > For additional commands, email: cocoon-dev-help@xml.apache.org
> 
> > --- esql.xsl.orig	Mon Sep  3 21:38:36 2001
> +++ esql.xsl	Tue Sep  4 09:18:41 2001
> @@ -705,23 +705,33 @@
>    </xsp:content>
>  </xsl:template>
>  
> -<xspdoc:desc>results in a set of elements whose names are the names of the columns.
the
> elements each have one text child, whose value is the value of the column interpreted
as a
> string. No special formatting is allowed here. If you want to mess around with the names
of the
> elements or the value of the text field, use the type-specific get methods and write
out the
> result fragment yourself.</xspdoc:desc>
> +<xspdoc:desc>results in a set of elements whose names are the names of the columns
or tag-name
> if given . the elements each have one text child, whose value is the value of the column
> interpreted as a string. No special formatting is allowed here. If you want to mess around
with
> the names of the elements or the value of the text field, use the type-specific get methods
and
> write out the result fragment yourself.</xspdoc:desc>
>  <xsl:template match="esql:row-results//esql:get-columns">
>    <xsl:variable name="tagcase"><xsl:value-of select="@tag-case"/></xsl:variable>
> +  <xsl:variable name="tagname"><xsl:value-of select="@tag-name"/></xsl:variable>
>    <xsl:choose>
>      <xsl:when test="$environment = 'cocoon1'">
>        <xsp:logic>
>          for (int _esql_i=1; _esql_i &lt;= _esql_query.resultset_metadata.getColumnCount();
> _esql_i++) {
> +          String tag-name =
> +            <xsl:choose>
> +              <xsl:when test="$tagname">
> +                "<xsl:value-of select='@tag-name'/>"
> +              </xsl:when>
> +              <xsl:otherwise>
> +                _esql_query.resultset_metadata.getColumnName(_esql_i)
> +              </xsl:otherwise>
> +            </xsl:choose>;
>            Node _esql_node = document.createElement(
>              <xsl:choose>
>                <xsl:when test="$tagcase='lower'">
> -                _esql_query.resultset_metadata.getColumnName(_esql_i).toLowerCase()
> +                tag-name.toLowerCase()
>                </xsl:when>
>                <xsl:when test="$tagcase='upper'">
> -                _esql_query.resultset_metadata.getColumnName(_esql_i).toUpperCase()
> +                tag-name.toUpperCase()
>                </xsl:when>
>                <xsl:otherwise>
> -                _esql_query.resultset_metadata.getColumnName(_esql_i)
> +                tag-name
>                </xsl:otherwise>
>              </xsl:choose>
>            );
> @@ -738,7 +748,14 @@
>      <xsl:when test="$environment = 'cocoon2'">
>        <xsp:logic>
>          for (int _esql_i = 1; _esql_i &lt;= _esql_query.resultset_metadata.getColumnCount();
> _esql_i++) {
> -          String _esql_tagname = _esql_query.resultset_metadata.getColumnName(_esql_i);
> +          <xsl:choose>
> +           <xsl:when test="@tag-name">
> +            String _esql_tagname = "<xsl:value-of select='@tag-name'/>";
> +           </xsl:when>
> +           <xsl:otherwise>
> +            String _esql_tagname = _esql_query.resultset_metadata.getColumnName(_esql_i);
> +           </xsl:otherwise>
> +          </xsl:choose>
>            <xsp:element>
>              <xsp:param name="name">
>                <xsl:choose>
> 
> > ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org


=====
Davanum Srinivas, JNI-FAQ Manager
http://www.jGuru.com/faq/JNI

__________________________________________________
Do You Yahoo!?
Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger
http://im.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message