﻿<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:param name="CodeReg"></xsl:param>

  <xsl:template match="/">
    <xsl:for-each select="outdoc">
      <CodeResult>
        <xsl:call-template name="PortalAnswerCodeResult">
          <xsl:with-param name="code" select="type"/>
        </xsl:call-template>
      </CodeResult>
    </xsl:for-each>
  </xsl:template>

  <xsl:template name="PortalAnswerCodeResult">
    <xsl:param name="code"/>
    <xsl:choose>
      <xsl:when test="$CodeReg='nwz' and $code = '558213010000'">
        <xsl:value-of select="'true'"/>
      </xsl:when>
      <xsl:when test="$CodeReg='chz' and $code = '558214010000'">
        <xsl:value-of select="'true'"/>
      </xsl:when>
      <xsl:when test="$CodeReg='exz' and ($code = '558213010000' or $code = '558214010000')">
        <xsl:value-of select="'true'"/>
      </xsl:when>
      <xsl:when test="$CodeReg='ext' and $code = '558217000000'">
        <xsl:value-of select="'true'"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="'false'"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
</xsl:stylesheet>
