[GeoNetwork-devel] help/suggestion list issue in 3.4.3 when used with xml attributes values + quick fix

Using a helper/suggestion dropdown when mapped to an attribute eg xlink:href
in the element

<gmd:verticalCRS xlink:href="urn:ogc:def:crs:EPSG::5701"/>

causes a javascript error.

<gmd:verticalCRS xlink:href="urn:ogc:def:crs:EPSG::5701"/> causes a
javascript error because 'COLON' literal is transposed to ':' .

heres a quick fix...
in metadata.xsl

<!-- Display the helper list -->
    <xsl:if test="normalize-space($helper)!=''">
      <xsl:variable name="refIdTmp">
        <xsl:choose>
          <xsl:when test="$attribute=true()">
            <xsl:value-of select="concat(../geonet:element/@ref, '_', name(.))"/>
          </xsl:when>
          <xsl:otherwise>
            <xsl:value-of select="geonet:element/@ref"/>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:variable>
      
      <xsl:variable name="refId" select="replace($refIdTmp, ':' ,
'COLON')"></xsl:variable>

      <xsl:text> </xsl:text>
      (<xsl:value-of select="/root/gui/strings/helperList"/>
      <select
onchange="$('_{$refId}').value=this.options[this.selectedIndex].value; if
($('_{$refId}').onkeyup) $('_{$refId}').onkeyup();" class="md">
        <option/>
        <!-- This assume that helper list is already sort in alphabetical order
in loc file. -->
        <xsl:copy-of select="exslt:node-set($helper)"/>
      </select>)
    </xsl:if>
--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/help-suggestion-list-issue-in-3-4-3-when-used-with-xml-attributes-values-quick-fix-tp4985916p4985916.html
Sent from the GeoNetwork developer mailing list archive at Nabble.com.

Hello Murray,
Could you provide your helper configuration to reproduce the issue? Thanks.

Francois

2010/4/30 murray king <murray.king@anonymised.com>:

Using a helper/suggestion dropdown when mapped to an attribute eg xlink:href
in the element

<gmd:verticalCRS xlink:href="urn:ogc:def:crs:EPSG::5701"/>

causes a javascript error.

<gmd:verticalCRS xlink:href="urn:ogc:def:crs:EPSG::5701"/> causes a
javascript error because 'COLON' literal is transposed to ':' .

heres a quick fix...
in metadata.xsl

<!-- Display the helper list -->
<xsl:if test="normalize-space($helper)!=''">
<xsl:variable name="refIdTmp">
<xsl:choose>
<xsl:when test="$attribute=true()">
<xsl:value-of select="concat(../geonet:element/@ref, '_', name(.))"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="geonet:element/@ref"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>

                   &lt;xsl:variable name=&quot;refId&quot; select=&quot;replace\($refIdTmp, &#39;:&#39; ,

'COLON')"></xsl:variable>

                   &lt;xsl:text&gt; &lt;/xsl:text&gt;
                   \(&lt;xsl:value\-of select=&quot;/root/gui/strings/helperList&quot;/&gt;
                   &lt;select

onchange="$('_{$refId}').value=this.options[this.selectedIndex].value; if
($('_{$refId}').onkeyup) $('_{$refId}').onkeyup();" class="md">
<option/>
<!-- This assume that helper list is already sort in alphabetical order
in loc file. -->
<xsl:copy-of select="exslt:node-set($helper)"/>
</select>)
</xsl:if>
--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/help-suggestion-list-issue-in-3-4-3-when-used-with-xml-attributes-values-quick-fix-tp4985916p4985916.html
Sent from the GeoNetwork developer mailing list archive at Nabble.com.

------------------------------------------------------------------------------
_______________________________________________
GeoNetwork-devel mailing list
GeoNetwork-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geonetwork-devel
GeoNetwork OpenSource is maintained at http://sourceforge.net/projects/geonetwork

Yes sure.
<labels>
...............................
    <element name="xlink:href">
        <label>Vertical CRS</label>
        <description>Vertical CRS</description>
        <helper>
    <option value="wgs84">wgs84</option>
    <option value="bng">bng</option>
    <option value="etrs89">etrs89</option>
      </helper>
    </element>
</labels>

used in a document context like

<gmd:verticalElement>
  <gmd:EX_VerticalExtent>
    <gmd:minimumValue>
      <gco:Real>0</gco:Real>
    </gmd:minimumValue>
    <gmd:maximumValue>
      <gco:Real>0</gco:Real>
    </gmd:maximumValue>
    <gmd:verticalCRS xlink:href="wgs84"/>
  </gmd:EX_VerticalExtent>
</gmd:verticalElement>

causes a null javascript ref in the html
<input class="md" id="_161_xlinkCOLONhref" name="_161_xlinkCOLONhref"
value="wgs84" size="50" type="text">
(Suggestions:<select
onchange="$('_161_xlinkCOLONhref').value=this.options[this.selectedIndex].value;
if ($('_161_xlinkCOLONhref').onkeyup) $('_161_xlinkCOLONhref').onkeyup();"
class="md">
<option></option>
<option value="wgs84">wgs84</option>
  <option value="bng">bng</option>
<option value="etrs89">etrs89</option>
</select>)

cheers

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/help-suggestion-list-issue-in-3-4-3-when-used-with-xml-attributes-values-quick-fix-tp4985916p5030814.html
Sent from the GeoNetwork developer mailing list archive at Nabble.com.