<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

<xsl:import href="ack_text"/>

<xsl:variable name="level_none">0</xsl:variable>
<xsl:variable name="level_debug">1</xsl:variable>
<xsl:variable name="level_info">2</xsl:variable>
<xsl:variable name="level_notice">3</xsl:variable>
<xsl:variable name="level_warn">4</xsl:variable>
<xsl:variable name="level_error">5</xsl:variable>
<xsl:variable name="level_critical">6</xsl:variable>
<xsl:variable name="level_fatal">7</xsl:variable>

<xsl:template match="status_check_failed_parentwithoutstatus">

***Error: parent <xsl:value-of select="parent/text()"/> does not have "status:"
  <xsl:value-of select="status/text()"/>
</xsl:template>

<xsl:template match="invalid_grandparent_status">

***Error: Cannot have 3 levels of hierarchy with status AGGREGATED-BY-LIR
</xsl:template>

<xsl:template match="status_check_failed_missingstatus">

***Error: missing "status:" attribute
</xsl:template>

<xsl:template match="status_check_failed_allocated">

***Error: ALLOCATED inetnum objects require the administrative maintainer.
  You probably want "status: ASSIGNED PA".
</xsl:template>

<xsl:template match="status_check_failed_allocbyrir">

***Error: ALLOCATED-BY-RIR inet6num objects require the administrative maintainer.
  You probably want "status: ALLOCATED-BY-LIR" or "status: ASSIGNED".
</xsl:template>

<xsl:template match="status_check_failed_modify">

***Error: Status <xsl:value-of select="status/text()"/> can only be set when an object is created.
          This status cannot be changed.
</xsl:template>

<xsl:template match="status_check_failed_anycast_rir">

***Error: Setting status ASSIGNED ANYCAST requires the administrative maintainer.
</xsl:template>

<xsl:template match="status_check_failed_rir">

***Error: setting status <xsl:value-of select="status/text()"/> requires the administrative maintainer.
</xsl:template>

<xsl:template match="status_check_failed_notset">

***Error: only the administrator can use NOT-SET status
</xsl:template>

<xsl:template match="status_check_failed_earlyregistration">

***Error: only the administrator can use EARLY-REGISTRATION status
</xsl:template>

<xsl:template match="RDNSrir">

***Info: Majority RIR is <xsl:apply-templates/>.
</xsl:template>

<xsl:template match="RDNSuseotherrir">

***Error: RIPE NCC is currently not responsible for the delegation
          this address space. Please use the appropriate RIR,
          in this case, <xsl:apply-templates/>.
</xsl:template>

<xsl:template match="RDNScannotregister">

***Error: RIPE NCC is currently not responsible for the delegation
          of this address space.
</xsl:template>

<xsl:template match="RDNSnonservers">

***Error: Domain object contains no nameservers.
</xsl:template>

<xsl:template match="RDNSnotdelegated">

***Error: RIPE NCC is currently not responsible for the delegation
          of this address space.
</xsl:template>

<xsl:template match="RDNSdelcheckwarning">

***RDNS:    <xsl:apply-templates/>

</xsl:template>

<xsl:template match="RDNSthreshold">

***Error: There are 20 or more problem points.
          Delegation was not successful.
</xsl:template>

<xsl:template match="RDNSremovedtrailingdot">

***Warning: Trailing dot has been removed from <xsl:apply-templates/>.
</xsl:template>

<xsl:template match="RDNSparenthasourns">

***Info: Parent has RIPE NCC nameservers.
</xsl:template>

<xsl:template match="RDNSparentisnotenum">

***Error: Parent is not e164.arpa.
</xsl:template>

<xsl:template match="RDNSoverlap">

***Error: Overlapping parent inetnum objects found.
</xsl:template>

<xsl:template match="RDNSinvalidrange">

***Error: The range
          <xsl:apply-templates/>
          is not a valid range for expansion. Both numbers must be in
          between 0-255 and the first number must be less than the second.
</xsl:template>

<xsl:template match="RDNSds_not_accepted">

***Error: DS records are not accepted for this zone.
</xsl:template>

<xsl:template match="RDNSsize_not_accepted">

***Error: Delegation of this size is not allowed.
          The allowed sizes are:
          IPv4 /8, /16, /24
          IPv6 /12, /16, /20, /24, /28, /32, /48, /64
          
          For delegations less than /24 (IPv4), contact ripe-dbm@ripe.net.
</xsl:template>

<xsl:template match="RDNSno_address_space">

***Error: no corresponding inet(6)num object found.
</xsl:template>

<xsl:template match="rdns_hierarchy">

***Error: Existing '<xsl:value-of select="specifics/text()"/>' specific domain object found '<xsl:value-of select="name/text()"/>'
</xsl:template>

  <xsl:template match="syntax_error">
<xsl:text>
***Error: Syntax error in object
</xsl:text>
  <xsl:value-of select="text()"/>
  </xsl:template>

  <xsl:template match="syntax_ok">
***Info: Syntax check passed
  </xsl:template>

  <xsl:template match="invalid_source">
***Error: Source [<xsl:value-of select="source/text()"/>] not recognised.
  </xsl:template>

  <xsl:template match="filtered_source">
***Error: Cannot submit filtered whois output for updates.
  </xsl:template>


  <xsl:template match="attr">
<xsl:text>
</xsl:text>
<xsl:value-of select="text()"/>: <xsl:value-of select="value"/>
<xsl:if test="count(syntax_error)>0">
<xsl:text></xsl:text>
***Error: <xsl:value-of select="syntax_error"/>
</xsl:if>
  </xsl:template>


  <xsl:template match="object_syntax_error">
<xsl:text>
</xsl:text>***Error: <xsl:value-of select="text()"/>
  </xsl:template>

  <xsl:template match="object_syntax_warn">
<xsl:text>
</xsl:text>***Warning: <xsl:value-of select="text()"/>
  </xsl:template>

  <xsl:template match="input_analyse">
<xsl:apply-templates select="bad_pgp_credentials"/>
<xsl:apply-templates select="bad_x509_credentials"/>
  </xsl:template>

  <xsl:template match="bad_pgp_credentials">
***Error: The following PGP credentials were not correct:
<xsl:apply-templates select="list"/>
<xsl:text>
</xsl:text>
  </xsl:template>

  <xsl:template match="bad_x509_credentials">
***Error: The following X.509 credentials were not correct:
<xsl:apply-templates select="list"/>
<xsl:text>
</xsl:text>
  </xsl:template>


  <xsl:template match="unparsable_input">
<xsl:value-of select="text()"/>
<xsl:text>
</xsl:text>
  </xsl:template>


<!-- Follows PGP key info, its big, ends with key_info case -->

<!--   <xsl:template match="ok">
key-cert operation OK
  </xsl:template> -->
  <xsl:template match="multiple_keys">
***Error: The supplied object has multiple keys
  </xsl:template>
  <xsl:template match="no_key">
***Error: The supplied object has no key 
  </xsl:template>
  <xsl:template match="key_exists">
***Error: The supplied key already exists
  </xsl:template>
  <xsl:template match="secret_key">
***Error: The supplied key is a secret key
  </xsl:template>
  <xsl:template match="ids_dont_match">
***Error: The supplied key and its ID don't match 
  </xsl:template>
  <xsl:template match="internal">
***Error: There was an internal error
  </xsl:template>
  <xsl:template match="unexistent_key">
***Error: Key doesn't exist
  </xsl:template>
  <xsl:template match="not_removed">
***Error: The key was not removed
  </xsl:template>
  <xsl:template match="unknown_error">
***Error: Unknown key-cert error
  </xsl:template>
  <xsl:template match="key_info"><xsl:apply-templates/></xsl:template>


  <xsl:template match="cert_error">
***Error: Certificate error: <xsl:value-of select="err_str/text()"/><xsl:text>
  </xsl:text>
  </xsl:template>
  <xsl:template match="no_fingerpr">
***Error: No fingerprint found in the supplied certificate
  </xsl:template>
  <xsl:template match="no_subject">
***Error: No subject found in the supplied certificate
  </xsl:template>


  <xsl:template match="non_existent_object">
***Error: This object does not exist in the database.<xsl:apply-templates/>
  </xsl:template>

  <xsl:template match="unknown_country">
***Error: Country not recognised: <xsl:apply-templates/>
  </xsl:template>

  <xsl:template match="unknown_nic_suffix">
***Error: Unknown NIC handle suffix used: <xsl:apply-templates/>
  </xsl:template>

  <xsl:template match="nichdl_not_available">
***Error: The nic-hdl '<xsl:value-of select="text()"/>' is not available.
  </xsl:template>

  <xsl:template match="nichdl_not_valid">
***Error: The nic-hdl '<xsl:value-of select="text()"/>' is not valid.
  </xsl:template>

  <xsl:template match="object_exists">
***Error: Object exists: <xsl:apply-templates/>
  </xsl:template>

  <xsl:template match="versions_dont_match">
***Error: This does not exactly match the object stored in the database.
<xsl:text>
</xsl:text>
  </xsl:template>

  <xsl:template match="versions_match">
***Warning: Submitted object identical to database object.
  </xsl:template>

  <xsl:template match="keycert_auto">
***Error: Name of a new X.509 key-cert object must be AUTO-nnn.<xsl:apply-templates/>
  </xsl:template>

  <xsl:template match="operation_failed">
***Error: Operation failed (<xsl:value-of select="operation/text()"/>)
  </xsl:template>



  <xsl:template match="notification_header_from">From: RIPE Database Administration  &lt;<xsl:value-of select="from/text()"/>&gt;</xsl:template>

  <xsl:template match="notification_header_to">
To: <xsl:value-of select="to/text()"/>
  </xsl:template>

  <xsl:template match="upd_result">
Subject: <xsl:value-of select="result/text()"/>
  </xsl:template>

  <xsl:template match="notification_header_subject">: <xsl:value-of select="subject/text()"/>
<xsl:text>

</xsl:text>
  </xsl:template>

  <xsl:template match="mail_origin_of_request">
>  From:       <xsl:value-of select="from/text()"/>       
>  Subject:    <xsl:value-of select="subject/text()"/>    
>  Date:       <xsl:value-of select="date/text()"/>       
>  Reply-To:   <xsl:value-of select="reply_to/text()"/>   
>  Message-ID: <xsl:value-of select="msgid/text()"/>      
<xsl:text>

</xsl:text>
  </xsl:template>

  <xsl:template match="ip_origin_of_request">
 - From-Host: <xsl:value-of select="ip/text()"/>
 - Date/Time: <xsl:value-of select="../process_time/p_time/text()"/>
  </xsl:template>

  <xsl:template match="operation_ok">
Operation OK (<xsl:value-of select="operation/text()"/>)
  </xsl:template>


  <xsl:template match="object">
<xsl:value-of select="text()"/>
  </xsl:template>

  <xsl:template match="mntner">
Maintainer: <xsl:value-of select="text()"/>
  </xsl:template>

  <xsl:template match="enforced_new_exists">
***Error: Enforced new keyword specified, but the object already exists in the database
  </xsl:template>

  <xsl:template match="invalid_keyword_combination">
***Warning: Invalid keyword combination found: <xsl:value-of select="text()"/>
***Warning: All keywords were ignored
  </xsl:template>

  <xsl:template match="invalid_keyword">
***Warning: Invalid keyword(s) found: <xsl:value-of select="text()"/>
***Warning: All keywords were ignored
  </xsl:template>

  <xsl:template match="circular_dependency">
***Error: Circular dependency in AUTO- references
  </xsl:template>

  <xsl:template match="object_still_referenced">
***Error: Object still referenced
  </xsl:template>

  <xsl:template match="object_not_referenced">
***Error: Object not referenced
  </xsl:template>

  <xsl:template match="object_not_found">
***Error: The object '<xsl:value-of select="object/text()"/>' was not found in the database
  </xsl:template>


  <xsl:template match="mail_from">
There is a MAIL-FROM in the object. <xsl:if test="only_mfrom">The maintainer has no other types of auth.</xsl:if>
<xsl:if test="ok">Operation OK.</xsl:if>
  </xsl:template>

  <xsl:template match="no_mail_from">
No MAIL-FROM in the object.
  </xsl:template>



  <xsl:template match="manual_creation">
Manual creation of the object.
  </xsl:template>

  <xsl:template match="automatic_creation">
Automatic creation</xsl:template>

  <xsl:template match="unknown_refered_object">
***Error: Refered object <xsl:value-of select="refered_object/text()"/> doesn't exist.</xsl:template>

  <xsl:template match="known_refered_object">
Refered object <xsl:value-of select="refered_object/text()"/> exists.
  </xsl:template>

  <xsl:template match="unknown_auto_key">
***Error: Unknown AUTO- key referenced: <xsl:value-of select="key/text()"/>
  </xsl:template>

  <xsl:template match="changed_date_missing">
<xsl:if test="$level_notice>$level">
***Warning: Date '<xsl:value-of select="date/text()"/>' added to changed: attribute '<xsl:value-of select="value/text()"/>'
</xsl:if>
</xsl:template>

  <xsl:template match="unmaintained_person">
<xsl:if test="$level_notice>$level">
***Warning: Un-maintained <xsl:value-of select="type/text()"/> object referenced ['<xsl:value-of select="key/text()"/>'].
</xsl:if>
</xsl:template>

  <xsl:template match="unmaintained_person_in_mntner">
<xsl:if test="$level_notice>$level">
***Warning: Un-maintained <xsl:value-of select="type/text()"/> object referenced ['<xsl:value-of select="key/text()"/>'] in mntner ['<xsl:value-of select="mntner/text()"/>'].
</xsl:if>
</xsl:template>

  <xsl:template match="startup">
<xsl:if test="$level_notice>$level">
***Info: To create a person/mntner pair of objects see
         http://www.db.ripe.net/cgi-bin/new-user-startup.pl
</xsl:if>
</xsl:template>

  <xsl:template match="inetnum_prefix_converted">
<xsl:if test="$level_notice>$level">
***Warning: Prefix '<xsl:value-of select="prefix/text()"/>' converted to range '<xsl:value-of select="range/text()"/>'
</xsl:if>
</xsl:template>

  <xsl:template match="inetnum_prefix_convert_failed">
<xsl:if test="$level_notice>$level">
***Error: Failed to convert '<xsl:value-of select="prefix/text()"/>' into range notation
</xsl:if>
</xsl:template>

  <xsl:template match="multiple_changed_date_missing">
***Error: More than one changed: attribute without date
  </xsl:template>

  <xsl:template match="changed_date_order">
***Error: The dates in the changed: attributes should be in accending order
          '<xsl:value-of select="value/text()"/>' was found after '<xsl:value-of select="previous/text()"/>'
  </xsl:template>

  <xsl:template match="changed_date_syntax">
***Error: <xsl:value-of select="message/text()"/>
  </xsl:template>

  <xsl:template match="postprocessed_object"></xsl:template>

  <xsl:template match="changed_date_syntax">
***Error: <xsl:value-of select="message/text()"/>
  </xsl:template>

  <xsl:template match="policy_fail">
***Error: Policy check fail: <xsl:value-of select="reason/text()"/>
  </xsl:template>

  <xsl:template match="key_add_error">
***Error: Unable to add key: <xsl:value-of select="error/text()"/>
  </xsl:template>

  <xsl:template match="key_modify_error">
***Error: Unable to modify key: <xsl:value-of select="error/text()"/>
<!-- ***Error: Unable to modify key: <xsl:if test="error/text()='KM_KEY_EXISTS'">Key exists</xsl:if> -->
  </xsl:template>

  <xsl:template match="key_remove_error">
***Error: Unable to remove key: <xsl:value-of select="error/text()"/>
  </xsl:template>

  <xsl:template match="incorrect_generated">
***Warning: Supplied attribute '<xsl:value-of select="text()"/>' has been replaced with generated value</xsl:template>


  <xsl:template match="pgp_error">
***Error: PGP reported:
<xsl:value-of select="error/text()"/>
  </xsl:template>

  <xsl:template match="pgp_ok">
No PGP error on object
  </xsl:template>

  <xsl:template match="non_existent_maintainer">
  
***Error: The maintainer '<xsl:value-of select="text()"/>' was not found in the database
  </xsl:template>

    <xsl:template match="deprecated_auth">
  
***Warning: CRYPT-PW was used during the authentication of 
            maintainer '<xsl:value-of select="text()"/>'
            CRYPT-PW is being deprecated from the RIPE Database.
            For more information, please visit:
            http://www.ripe.net/db/support/security/crypt-pw_deprecation/
    </xsl:template>
    
    <xsl:template match="disallow_mntner">
***Error: The mntner '<xsl:value-of select="mntner/text()"/>' is not allowed.
  </xsl:template>

  <xsl:template match="non_existent_irt">
  
***Error: The irt '<xsl:value-of select="text()"/>' was not found in the database
  </xsl:template>

  <xsl:template match="non_existent_org">
 
***Error: The organisation '<xsl:value-of select="text()"/>' was not found in the database
  </xsl:template>

  <xsl:template match="wrong_org_attr_optionality">

***Error: Missing required "org:" attribute.
  </xsl:template>

  <xsl:template match="missing_ass_size_attr">

***Error: Missing required "assignment-size:" attribute.
  </xsl:template>

  <xsl:template match="ass_size_attr_found">

***Error: "assignment-size:" attribute only allowed with status AGGREGATED-BY-LIR.
  </xsl:template>

  <xsl:template match="wrong_ass_size">

***Error: "assignment-size:" value must be greater then prefix size.
  </xsl:template>

  <xsl:template match="ass_size_changed">

***Error: "assignment-size:" cannot be changed (was <xsl:value-of select="old_ass_size/text()"/>).
  </xsl:template>

  <xsl:template match="ass_size_out_of_bounds">

***Error: "assignment-size:" value must be in the range 1-128.
  </xsl:template>

  <xsl:template match="invalid_more_specific_prefix_size">

***Error: In a hierarchy of "AGGREGATED-BY-LIR" objects
          the more specific object prefix size must be equal to
          the less specific object assignment-size (<xsl:value-of select="parent_ass_size/text()"/>).
  </xsl:template>

  <xsl:template match="organisation_creation_without_auto_id">
  
***Error: The organisation ID must be AUTO-id for organisation object creations.
***Error: For example, you can use AUTO-1.
  </xsl:template>

  <xsl:template match="addr_format_error">

***Error: IP address format error <xsl:value-of select="ping_add/text()"/>).
  </xsl:template>

  <xsl:template match="ping_addr_space_mismatch">

***Error: pingable address space (<xsl:value-of select="ping_add/text()"/>) does not match route prefix space.
  </xsl:template>

  <xsl:template match="ping_addr_outside_prefix">

***Error: pingable address (<xsl:value-of select="ping_add/text()"/>) is not within route prefix.
  </xsl:template>

  <xsl:template match="peering_set_syntax">

***Error: a peering-set object must contain at least one mp-peering or peering attribute
  </xsl:template>

  <xsl:template match="filter_set_syntax">

***Error: a filter-set object cannot contain both mp-filter and filter attributes
  </xsl:template>

  <xsl:template match="as_block_range">

***Error: the as-block range is invalid
  </xsl:template>

  <xsl:template match="non_existent_origin">

***Error: The origin AS object does not exist
  </xsl:template>

  <xsl:template match="non_existent_parent">

***Error: There is no parent object
  </xsl:template>

  <xsl:template match="multiple_parents">

***Error: The following multiple overlapping parents were found:
<xsl:apply-templates/>
***Info: All but one of these parent networks must be
         deleted before the child can be created.
         If you are not the maintainer of the invalid parent(s), 
         please contact the maintainer.
  </xsl:template>

  <xsl:template match="overlap_inetnums">

***Error: This inetnum overlaps with the following:
<xsl:apply-templates/>
***Info: This conflict must be resolved before 
         the inetnum can be created.
         If you are not the maintainer of the conflicting inetnum(s),
         please contact the maintainer.
  </xsl:template>

  <xsl:template match="slash_not_allowed">

***Error: The slash notation is only allowed for object creation.
  </xsl:template>

  <xsl:template match="cryptpw_not_allowed">

***Error: The creation or modification of CRYPT-PW passwords is not permitted.
          CRYPT-PW is being deprecated. For more information, please visit:
          http://www.ripe.net/db/support/security/crypt-pw_deprecation/
  </xsl:template>

  <xsl:template match="no_mntners">
  
***Error: The <xsl:value-of select="parent_text/text()"/> [<xsl:value-of select="type/text()"/>] <xsl:value-of select="key/text()"/>
          contains no applicable maintainers for this route 
          in "mnt-routes:" attribute(s).
  </xsl:template>

  <xsl:template match="invalid_mnt_routes">

***Warning: The <xsl:value-of select="parent_text/text()"/> [<xsl:value-of select="type/text()"/>] <xsl:value-of select="key/text()"/> 
          has invalid prefix ranges in "mnt-routes:" attribute(s):  
  <xsl:apply-templates select="invalid_list"/>
***Info: Therefore the following mntners will not be checked:
  <xsl:apply-templates select="failed_mntners"/>
  </xsl:template>

  <xsl:template match="invalid_list">
  <xsl:text>        </xsl:text><xsl:apply-templates select="list"/>
  <xsl:text>
  </xsl:text>
  </xsl:template>

  <xsl:template match="failed_mntners">
  <xsl:text>       </xsl:text><xsl:apply-templates select="list"/>
  <xsl:text>
  </xsl:text>
  </xsl:template>

  <xsl:template match="name_changed">
***Error: Person/Role name cannot be changed automatically.
          Please create another Person/Role object and modify any references
          to the old object, then delete the old object.
  </xsl:template>

  <xsl:template match="rip_update_error">
  <xsl:text>
</xsl:text><xsl:value-of select="error/text()"/>
  </xsl:template>


<!-- AU module -->

  <xsl:template match="auth_info">

***Info: Authorisation for <xsl:value-of select="parent_text/text()"/> [<xsl:value-of select="type/text()"/>] <xsl:if test="substring(key/text(), 1, 5)='AUTO-'"><xsl:value-of select="../../../@id"/></xsl:if><xsl:if test="substring(key/text(), 1, 5)!='AUTO-'"><xsl:value-of select="key/text()"/></xsl:if> <xsl:text>
  </xsl:text>
  <xsl:apply-templates select="no_maintainer | attribute_checked"/>
  <xsl:apply-templates select="mnt_auth_ok"/>
  <xsl:apply-templates select="mnt_auth_fail"/>
  <xsl:if test="count(mnt_auth_ok/*) = 0 and count(mnt_auth_fail/*) = 0">
         no valid maintainer found</xsl:if>
  </xsl:template>

  <xsl:template match="attribute_checked">       using <xsl:value-of select="text()"/>:</xsl:template>
  <xsl:template match="no_maintainer">       no maintainer found  <xsl:apply-templates/>
  </xsl:template>
  <xsl:template match="mnt_auth_fail">
<xsl:text>
  </xsl:text>       not authenticated by: <xsl:apply-templates/></xsl:template>
  <xsl:template match="mnt_auth_ok">
<xsl:text>
  </xsl:text>       authenticated by: <xsl:apply-templates/> </xsl:template>

  <xsl:template match="irt_auth_info">

***Info: Authorisation for  [<xsl:value-of select="type/text()"/>] <xsl:value-of select="key/text()"/> <xsl:text>
  </xsl:text>
  <xsl:apply-templates select="no_irt | attribute_checked"/>
  <xsl:apply-templates select="irt_auth_ok"/>
  <xsl:apply-templates select="irt_auth_fail"/>
  <xsl:if test="count(irt_auth_ok/*) = 0 and count(irt_auth_fail/*) = 0">
         no valid irt found</xsl:if>
  </xsl:template>

  <xsl:template match="org_auth_info">

***Info: Authorisation for  [<xsl:value-of select="type/text()"/>] <xsl:value-of select="key/text()"/> <xsl:text>
  </xsl:text>
  <xsl:apply-templates select="no_org | attribute_checked"/>
  <xsl:apply-templates select="org_auth_ok"/>
  <xsl:apply-templates select="org_auth_fail"/>
  <xsl:if test="count(org_auth_ok/*) = 0 and count(org_auth_fail/*) = 0 and
                 (not(../../../org_auth_result) or not(../../../org_auth_result/organisation_type_check_failed))">
         no valid organisation found</xsl:if>
  </xsl:template>

  <xsl:template match="org_creation_auth_result">
  <xsl:if test="fail">

***Error: This org-type value can only be set by certain mntners.</xsl:if>
  </xsl:template>

  <xsl:template match="org_auth_result">
  <xsl:if test="organisation_type_check_failed">

***Error: This org-type value can only be set by certain mntners.</xsl:if>
  </xsl:template>


  <xsl:template match="attribute_checked">       using <xsl:value-of select="text()"/>:</xsl:template>
  <xsl:template match="no_irt">       no irt found  <xsl:apply-templates/>
  </xsl:template>

  <xsl:template match="no_org">       no organisation found  <xsl:apply-templates/>
  </xsl:template>

  <xsl:template match="irt_auth_fail">
<xsl:text>
  </xsl:text>       not authenticated by: <xsl:apply-templates/></xsl:template>

  <xsl:template match="org_auth_fail">
<xsl:text>
  </xsl:text>       not authenticated by: <xsl:apply-templates/></xsl:template>

  <xsl:template match="irt_auth_ok">
<xsl:text>
  </xsl:text>       authenticated by: <xsl:apply-templates/> </xsl:template>

  <xsl:template match="org_auth_ok">
<xsl:text>
  </xsl:text>       authenticated by: <xsl:apply-templates/> </xsl:template>


<!-- 
  <xsl:template match="auth_result">
  <xsl:if test="(../../../@operation!='Forward')>0">
  <xsl:if test="(../../../@result='ERR')>0">
  <xsl:if test="ok">
***Info: Authorisation passed</xsl:if>
  </xsl:if>
  <xsl:if test="fail">
***Error: Authorisation failed</xsl:if>

  </xsl:if>
  
  </xsl:template>
-->

<!--
  <xsl:template match="auth_result">
  <xsl:if test="(../../../@operation!='Forward')>0">
  <xsl:if test="(../../../@result='ERR')>0">
  <xsl:if test="ok">
    <xsl:if test="../../../irt_auth_result/ok or not(../../../irt_auth_result)">
***Info: Authorisation passed</xsl:if>
    <xsl:if test="../../../irt_auth_result/fail">
***Error: Authorisation failed</xsl:if>
    <xsl:if test="../../../org_auth_result/ok or not(../../../org_auth_result)">
***Info: Authorisation passed</xsl:if>
    <xsl:if test="../../../org_auth_result/fail">
***Error: Authorisation failed</xsl:if>
    </xsl:if>
  </xsl:if>
  <xsl:if test="fail">
***Error: Authorisation failed</xsl:if>
  </xsl:if>
  </xsl:template>
-->

  <xsl:template match="auth_result">
  <xsl:if test="((../../../@operation!='Forward Create')>0) and
                  ((../../../@operation!='Forward Modify')>0) and
                  ((../../../@operation!='Forward Delete')>0) and
                  ((../../../@operation!='Forward Policy')>0)">
    <xsl:if test="(../../../@result='ERR')>0">
      <xsl:if test="ok and (../../../irt_auth_result/ok or not(../../../irt_auth_result))
                      and (../../../org_auth_result/ok or not(../../../org_auth_result))
                      and (../../../org_creation_auth_result/ok or not(../../../org_creation_auth_result))">
***Info: Authorisation passed</xsl:if>
    </xsl:if>
    <xsl:if test="fail or ../../../irt_auth_result/fail or ../../../org_auth_result/fail or ../../../org_creation_auth_result/fail">
***Error: Authorisation failed</xsl:if>

  </xsl:if>
  </xsl:template>

  <xsl:template match="rdns_auth_result">
  <xsl:if test="ok">

***Info: RDNS Authorisation passed</xsl:if>
  <xsl:if test="fail">

***Error: RDNS Authorisation failed</xsl:if>
  <xsl:if test="override">
***Info: Authorisation override used</xsl:if>
  </xsl:template>

<!-- lists -->
  <xsl:template match="list">
<xsl:value-of select="text()"/><xsl:if test="not(position()=last())">, </xsl:if></xsl:template>


  <xsl:template match="list_line">
<xsl:text>          </xsl:text><xsl:value-of select="text()"/><xsl:if test="not(position()=last())">, </xsl:if><xsl:text>
</xsl:text>

</xsl:template>

<!-- root node -->
  <xsl:template match="/">
    <xsl:apply-templates/>
  </xsl:template>

  <xsl:template match="obj">

---
<xsl:if test="(@result='ERR')>0"> 
<xsl:if test="(@operation!='Syntax Error')>0"><xsl:value-of select="@operation"/></xsl:if>
<xsl:if test="(@operation='Syntax Error')>0">Update</xsl:if> FAILED:</xsl:if>

<xsl:if test="(@result='OK')>0">
<!--
<xsl:if test="((@operation!='Forward Create')>0) and
                ((@operation!='Forward Modify')>0) and
                ((@operation!='Forward Delete')>0) and
                ((@operation!='Forward Policy')>0)">
-->
<xsl:if test="( (@operation!='Forward Create') and 
                  (@operation!='Forward Modify') and
                  (@operation!='Forward Delete') and
                  (@operation!='Forward Policy') )>0">
<xsl:value-of select="@operation"/> <xsl:if test="(@operation!='No Operation')>0"><xsl:text> </xsl:text>SUCCEEDED</xsl:if></xsl:if>
<!--
<xsl:if test="( (@operation='Forward Create')>0) or
                 ((@operation='Forward Modify')>0) or
                 ((@operation='Forward Delete')>0) or
                 ((@operation='Forward Policy')>0)">No Operation</xsl:if>
-->
<xsl:if test="( (@operation='Forward Create') or
                   (@operation='Forward Modify') or
                   (@operation='Forward Delete') or
                   (@operation='Forward Policy') >0)">No Operation</xsl:if>
<xsl:text>:</xsl:text></xsl:if>

<xsl:text> [</xsl:text><xsl:value-of select="class/@class"/><xsl:text>] </xsl:text>
<xsl:value-of select="@id"/>
<xsl:if test="(class/@class='person' or class/@class='role')>0"><xsl:text> </xsl:text><xsl:value-of select="pr_name/@pr_name"/>
</xsl:if>

    <xsl:apply-templates select="*[name()='composite']">
      <xsl:with-param name="level" select="$level"/>
      <xsl:with-param name="summary" select="1"/>
    </xsl:apply-templates>


    <xsl:apply-templates select="*[name()='syntax_error' or name()='syntax_warn' or (name()='syntax_ok' and (../@result='ERR')>0)]">
      <xsl:with-param name="level" select="$level"/>
    </xsl:apply-templates>

<xsl:if test="((@operation!='Forward Create')>0) and
                ((@operation!='Forward Modify')>0) and
                ((@operation!='Forward Delete')>0) and
                ((@operation!='Forward Policy')>0)">
    <xsl:apply-templates select="*[(name()!='composite' and (name()!='attr' or (../@result='ERR')>0) and name()!='syntax_ok' and name()!='syntax_error' and name()!='syntax_warn')]">
      <xsl:with-param name="level" select="$level"/>
    </xsl:apply-templates>

    <xsl:apply-templates select="*[name()='composite']">
      <xsl:with-param name="level" select="$level"/>
      <xsl:with-param name="summary" select="0"/>
    </xsl:apply-templates>
</xsl:if>
<xsl:if test="(@operation='Forward Create')>0">

***Info: <xsl:value-of select="class/@class"/>: objects cannot be created automatically
         The object has been forwarded to the RIPE
         Database Administration for authorisation.
         You will receive further notification when 
         this request is processesed.
         No further action from your part is required.
</xsl:if>
<xsl:if test="(@operation='Forward Modify')>0">

***Info: <xsl:value-of select="class/@class"/>: objects cannot be modified automatically
         The object has been forwarded to the RIPE
         Database Administration for authorisation.
         You will receive further notification when 
         this request is processesed.
         No further action from your part is required.
</xsl:if>
<xsl:if test="(@operation='Forward Delete')>0">

***Info: <xsl:value-of select="class/@class"/>: objects cannot be deleted automatically
         The object has been forwarded to the RIPE
         Database Administration for authorisation.
         You will receive further notification when 
         this request is processesed.
         No further action from your part is required.
</xsl:if>

  </xsl:template>

  <xsl:template match="report">
      <xsl:apply-templates select="notification_header_from" />
      <xsl:apply-templates select="notification_header_to" />
      <xsl:apply-templates select="upd_result" />
      <xsl:apply-templates select="notification_header_subject" />
      <xsl:apply-templates select="input_analyse" />
      <xsl:apply-templates select="mail_origin_of_request" />
      <xsl:apply-templates select="ip_origin_of_request" />


  <xsl:choose>
    <xsl:when test="help_request">
      <xsl:call-template name="DB_help" />
    </xsl:when>
    <xsl:otherwise>

    <xsl:choose>
      <xsl:when test="internal_error">
        <xsl:call-template name="internal_error" />
      </xsl:when>
    </xsl:choose>

SUMMARY OF UPDATE:

Number of objects found:                   <xsl:value-of select="count(obj)"/>
Number of objects processed successfully:  <xsl:value-of select="count(obj[@result='OK'])"/>
  Create:         <xsl:value-of select="count(obj[@result='OK' and @operation='Create'])"/>
  Modify:         <xsl:value-of select="count(obj[@result='OK' and @operation='Modify'])"/>
  Delete:         <xsl:value-of select="count(obj[@result='OK' and @operation='Delete'])"/>
  No Operation:   <xsl:value-of select="count(obj[@result='OK' and @operation='No Operation'])+count(obj[@result='OK' and (@operation='Forward Create' or @operation='Forward Modify' or @operation='Forward Delete' or @operation='Forward Policy')])"/>
Number of objects processed with errors:   <xsl:value-of select="count(obj[@result='ERR'])"/>
  Create:         <xsl:value-of select="count(obj[@result='ERR' and @operation='Create'])"/>
  Modify:         <xsl:value-of select="count(obj[@result='ERR' and @operation='Modify'])"/>
  Delete:         <xsl:value-of select="count(obj[@result='ERR' and @operation='Delete'])"/>
  Syntax Errors:  <xsl:value-of select="count(obj[@result='ERR' and @operation='Syntax Error'])"/>


DETAILED EXPLANATION:

      <xsl:apply-templates select="invalid_keyword_combination">
        <xsl:with-param name="level" select="@level"/>
      </xsl:apply-templates>

      <xsl:apply-templates select="invalid_keyword">
        <xsl:with-param name="level" select="@level"/>
      </xsl:apply-templates>

      <xsl:apply-templates select="circular_dependency">
        <xsl:with-param name="level" select="@level"/>
      </xsl:apply-templates>

    <xsl:if test="count(obj[@result='ERR'])>0">
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The following object(s) were found to have ERRORS:
      <xsl:apply-templates select="obj[@result='ERR']">
        <xsl:with-param name="level" select="@level"/>
      </xsl:apply-templates>
    </xsl:if>
    <xsl:if test="count(obj[@result='OK'])>0">
    
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The following object(s) were processed SUCCESSFULLY:
      <xsl:apply-templates select="obj[@result='OK']">
        <xsl:with-param name="level" select="@level"/>
      </xsl:apply-templates>
    </xsl:if>
    <xsl:if test="count(unparsable_input)>0">
    
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The following paragraph(s) do not look like objects
and were NOT PROCESSED:

<xsl:apply-templates select="unparsable_input"/>
    </xsl:if>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    </xsl:otherwise>
  </xsl:choose>

<xsl:call-template name="tandc" />

<xsl:call-template name="contact" />
  </xsl:template>

<!-- level stuff
  <xsl:template match="level">
    <xsl:element name="level"><xsl:attribute name="level"><xsl:value-of select="@level"/></xsl:attribute><xsl:apply-templates/></xsl:element>
  </xsl:template>
-->

<!-- composite/summary -->
  <xsl:template match="composite">

    <xsl:if test="((../@operation!='Forward Create')>0) and
                    ((../@operation!='Forward Modify')>0) and
                    ((../@operation!='Forward Delete')>0) and
                    ((../@operation!='Forward Policy')>0)">

      <xsl:if test="$summary=1">
      <xsl:apply-templates select="summary"/>
      </xsl:if>
      <xsl:if test="$summary=0">
      <xsl:apply-templates select="*[name()!='summary']"/>
      <xsl:if test="summary/auth_result/@override">
         Authorisation override used
      </xsl:if>
      </xsl:if>
    </xsl:if>

  </xsl:template>




<!--
  <xsl:template match="summary">
      <xsl:apply-templates/>
  </xsl:template>
  -->
</xsl:stylesheet>
