[GeoNetwork-devel] Carraige returns being doubled

Hi all,

            I have found a bug in Geonetwork that causes carriage returns to
be doubled (every instance is doubled) in textareas each time I rebuild the
edit form. I can't find anywhere in the XSL that might do this so I was
hoping that someone might have some idea where this might be happening.

Thank you.

--
Steven Smith <steven.smith@anonymised.com>
Software Developer / Analyst

Geometry Pty Ltd

Telephone

:

03 6223 1999

Facsimile

:

03 6223 1988

Web

:

www.geometryit.com
<file:///C:\Documents%20and%20Settings\ssmith.GEOMETRY\Application%20Data\Mi
crosoft\Signatures\www.geometryit.com>

Address

:

31 Salamanca Square, Battery Point, TAS 7004, Australia

Postal

:

PO Box 844, Sandy Bay, TAS 7006, Australia

Building Intelligent Business through the Power of Spatial

Hi Steven,

I’ve reported the same bug one month ago. You’ll find the answer by François
Prunayre in the geonetwork developer mailing list with “extra new lines in
textarea fields” subject. François proposed the next quick workaround:

Line 667 in metadata.xsl

Replace <xsl:value-of select="text()"/>

By

     <xsl:call-template name="preformattedEdit">
      <xsl:with-param name="text" select="text()"/>
     </xsl:call-template>

And add this template to metadata.xsl

<xsl:template name="preformattedEdit">
  <xsl:param name="text"/>
  <xsl:choose>
   <xsl:when test="contains($text,'&#13;&#10;')">
    <xsl:value-of select="substring-before($text,'&#13;&#10;')"/>
    <xsl:text>&#13;</xsl:text>
    <xsl:call-template name="preformattedEdit">
     <xsl:with-param name="text"
select="substring-after($text,'&#13;&#10;')"/>
    </xsl:call-template>
   </xsl:when>
   <xsl:otherwise>
    <xsl:value-of select="$text"/>
   </xsl:otherwise>
  </xsl:choose>
</xsl:template>

And it works very fine!

Best Regards,

Angel Zaballos

--

Angel Zaballos

Software Engineer

GTD SISTEMAS DE INFORMACIÓN

Pg. Garcia Fària, 17

E-08005 Barcelona

www.gtd.es

Tel: +34 934 939 300

Fax: +34 932 255 080

angel.zaballos@anonymised.com

  _____

De: geonetwork-devel-bounces@lists.sourceforge.net
[mailto:geonetwork-devel-bounces@lists.sourceforge.net] En nombre de Steven
Smith
Enviado el: viernes, 17 de noviembre de 2006 4:19
Para: geonetwork-devel@lists.sourceforge.net
Asunto: [GeoNetwork-devel] Carraige returns being doubled

Hi all,

            I have found a bug in Geonetwork that causes carriage returns to
be doubled (every instance is doubled) in textareas each time I rebuild the
edit form. I can’t find anywhere in the XSL that might do this so I was
hoping that someone might have some idea where this might be happening.

Thank you.

--
Steven Smith <steven.smith@anonymised.com>
Software Developer / Analyst

Geometry Pty Ltd

Telephone

:

03 6223 1999

Facsimile

:

03 6223 1988

Web

:

www.geometryit.com
<file:///C:\Documents%20and%20Settings\ssmith.GEOMETRY\Application%20Data\Mi
crosoft\Signatures\www.geometryit.com>

Address

:

31 Salamanca Square, Battery Point, TAS 7004, Australia

Postal

:

PO Box 844, Sandy Bay, TAS 7006, Australia

Building Intelligent Business through the Power of Spatial

I tried this, but it turns out that it has already happened by this stage.
So while this code works, it is not where my problem is. I can’t see
anywhere in the HTML that might do this. It happens in Firefox, IE and
Opera, so it is not the browser. The only area I know of that might do it,
although I can’t see any reason for it to affect it in this way, is the
EditLib code that adds the geonet elements.

The way I work, which is for adding a new format, is to alter my XSL
templates and then make Geonetwork update the edit page by switching between
Simple View and XML View. It seems that the double newline issue is
occurring when I go from Simple to XML View. The extra newlines are already
in the XML View when I get there. Then, when I switch back to Simple View to
see my XSL changes, it presents the extra newlines as they were in XML View.
So from this, I don’t think it is in the XSL templates, or if it is, it is
in the XML View portion of them.

Just to clarify this, if I add a new line (and text after it) to a textarea
while in XML View, and then switch to Simple View, I do NOT get the double
newline problem. But if I add the newline (ant text) while in Simple View,
and then switch to XML View, I DO get the double newline problem. So it
seems that it is in the preparation on the XML View page.

--
Steven Smith <steven.smith@anonymised.com>
Software Developer / Analyst

Geometry Pty Ltd

Telephone

:

03 6223 1999

Facsimile

:

03 6223 1988

Web

:

www.geometryit.com
<file:///C:\Documents%20and%20Settings\ssmith.GEOMETRY\Application%20Data\Mi
crosoft\Signatures\www.geometryit.com>

Address

:

31 Salamanca Square, Battery Point, TAS 7004, Australia

Postal

:

PO Box 844, Sandy Bay, TAS 7006, Australia

Building Intelligent Business through the Power of Spatial

  _____

From: geonetwork-devel-bounces@lists.sourceforge.net
[mailto:geonetwork-devel-bounces@lists.sourceforge.net] On Behalf Of Angel
Zaballos
Sent: Friday, 17 November 2006 7:18 PM
To: geonetwork-devel@lists.sourceforge.net
Subject: Re: [GeoNetwork-devel] Carraige returns being doubled

Hi Steven,

I’ve reported the same bug one month ago. You’ll find the answer by François
Prunayre in the geonetwork developer mailing list with “extra new lines in
textarea fields” subject. François proposed the next quick workaround:

Line 667 in metadata.xsl

Replace <xsl:value-of select="text()"/>

By

     <xsl:call-template name="preformattedEdit">
      <xsl:with-param name="text" select="text()"/>
     </xsl:call-template>

And add this template to metadata.xsl

<xsl:template name="preformattedEdit">
  <xsl:param name="text"/>
  <xsl:choose>
   <xsl:when test="contains($text,'&#13;&#10;')">
    <xsl:value-of select="substring-before($text,'&#13;&#10;')"/>
    <xsl:text>&#13;</xsl:text>
    <xsl:call-template name="preformattedEdit">
     <xsl:with-param name="text"
select="substring-after($text,'&#13;&#10;')"/>
    </xsl:call-template>
   </xsl:when>
   <xsl:otherwise>
    <xsl:value-of select="$text"/>
   </xsl:otherwise>
  </xsl:choose>
</xsl:template>

And it works very fine!

Best Regards,

Angel Zaballos

--

Angel Zaballos

Software Engineer

GTD SISTEMAS DE INFORMACIÓN

Pg. Garcia Fària, 17

E-08005 Barcelona

www.gtd.es

Tel: +34 934 939 300

Fax: +34 932 255 080

angel.zaballos@anonymised.com

  _____

De: geonetwork-devel-bounces@lists.sourceforge.net
[mailto:geonetwork-devel-bounces@lists.sourceforge.net] En nombre de Steven
Smith
Enviado el: viernes, 17 de noviembre de 2006 4:19
Para: geonetwork-devel@lists.sourceforge.net
Asunto: [GeoNetwork-devel] Carraige returns being doubled

Hi all,

            I have found a bug in Geonetwork that causes carriage returns to
be doubled (every instance is doubled) in textareas each time I rebuild the
edit form. I can’t find anywhere in the XSL that might do this so I was
hoping that someone might have some idea where this might be happening.

Thank you.

--
Steven Smith <steven.smith@anonymised.com>
Software Developer / Analyst

Geometry Pty Ltd

Telephone

:

03 6223 1999

Facsimile

:

03 6223 1988

Web

:

www.geometryit.com
<file:///C:\Documents%20and%20Settings\ssmith.GEOMETRY\Application%20Data\Mi
crosoft\Signatures\www.geometryit.com>

Address

:

31 Salamanca Square, Battery Point, TAS 7004, Australia

Postal

:

PO Box 844, Sandy Bay, TAS 7006, Australia

Building Intelligent Business through the Power of Spatial