<?xml version="1.0" encoding="UTF-8"?>
<!--
/*
 * UNIMARC Doc HTML Transformation Stylesheet
 * Produced by BookMARC - Serviços de Informação Bibliográfica, Lda. 
 * http://www.bookmarc.pt 
 * $Revision: 1.1.1.1 $
 * $Date: 2002/07/18 15:36:13 $
 */
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output method="html"/>
    <xsl:template match="/">
        <HTML>
            <HEAD>
                <TITLE>UNIMARC Doc</TITLE>
            </HEAD>
            <BODY>
                <TABLE ALIGN="CENTER" BORDER="0" CELLSPACING="1" CELLPADDING="3">
                    <TR>
                        <TD BGCOLOR="#5A738C" COLSPAN="2" ALIGN="CENTER">
                            <FONT COLOR="WHITE" SIZE="+2">
                                <B>UNIMARC Doc</B>
                                <BR/>
                                <FONT SIZE="-2">
					This is a rendering of a XML version of the Unimarc Manual
					available originally in HTML at http://www.ifla.org/VI/3/p1996-1/sec-uni.htm.
					<BR/>
					The Unimarc Manual is Copyright by IFLA.
					<BR/>
					The XML version is strictly for internal development and documentation purposes
					of BookMARC, LDA (http://www.bookmarc.pt)</FONT>
                            </FONT>
                        </TD>
                    </TR>
                    <TR>
                        <TD BGCOLOR="#5A738C" COLSPAN="2" ALIGN="CENTER">
                            <FONT COLOR="WHITE" SIZE="-1">
                                <B>Note: due to the size of the UnimarcDoc XML document, it is broken in separate files. This file only contains the fields in the table bellow.</B>
                            </FONT>
                        </TD>
                    </TR>
                    <TR>
                        <TD BGCOLOR="#5A738C">
                            <B>
                                <FONT COLOR="WHITE">Tag</FONT>
                            </B>
                        </TD>
                        <TD BGCOLOR="#5A738C">
                            <B>
                                <FONT COLOR="WHITE">Name</FONT>
                            </B>
                        </TD>
                    </TR>
                    <!-- Listar todos os campos -->
                    <xsl:for-each select="//FIELD">
                        <TR>
                            <!-- Criar um link para cada um dos campos -->
                            <TD BGCOLOR="#D9E2EA">
                                <FONT SIZE="-1">
                                    <A>
                                        <xsl:attribute name="HREF">#<xsl:value-of select="@tag"/></xsl:attribute>
                                        <xsl:value-of select="@tag"/>
                                    </A>
                                </FONT>
                            </TD>
                            <TD BGCOLOR="#D9E2EA">
                                <FONT SIZE="-1">
                                    <xsl:value-of select="@name"/>
                                </FONT>
                            </TD>
                        </TR>
                    </xsl:for-each>
                </TABLE>
                <BR/>
                <BR/>
                <BR/>
                <!-- Criar uma tabela para todos os campos -->
                <!-- Start fields -->
                <xsl:for-each select="//FIELD">
                    <TABLE BORDER="1" CELLSPACING="0" CELLPADDING="2">
                        <!-- Variavel q guarda a tag de cada campo -->
                        <xsl:variable name="FieldTag" select="@tag"/>
                        <TR>
                            <TD COLSPAN="2" BGCOLOR="#5A738C" ALIGN="CENTER">
                                <FONT SIZE="+1" COLOR="WHITE">
                                    <B>
                                        <!-- Atribuir um nome a cada um dos campos -->
                                        <A>
                                            <xsl:attribute name="NAME"><xsl:value-of select="$FieldTag"/></xsl:attribute>
                                        </A>
                                        <xsl:value-of select="@tag"/> : <xsl:value-of select="@name"/>
                                    </B>
                                </FONT>
                            </TD>
                        </TR>
                        <!-- Mandatory -->
                        <TR>
                            <TD BGCOLOR="#D9E2EA" VALIGN="TOP">
                                <FONT SIZE="-1">Mandatory</FONT>
                            </TD>
                            <TD>
                                <xsl:choose>
                                    <xsl:when test="@mandatory = 'y'">Yes</xsl:when>
                                    <xsl:otherwise>No</xsl:otherwise>
                                </xsl:choose>
                            </TD>
                        </TR>
                        <!-- Repeatable -->
                        <TR>
                            <TD BGCOLOR="#D9E2EA" VALIGN="TOP">
                                <FONT SIZE="-1">Repeatable</FONT>
                            </TD>
                            <TD>
                                <xsl:choose>
                                    <xsl:when test="@repeatable = 'y'">Yes</xsl:when>
                                    <xsl:otherwise>No</xsl:otherwise>
                                </xsl:choose>
                            </TD>
                        </TR>
                        <!-- First Indicator -->
                        <TR>
                            <TD BGCOLOR="#D9E2EA" VALIGN="TOP">
                                <FONT SIZE="-1">First Indicator</FONT>
                            </TD>
                            <TD>
                                <xsl:value-of select="IND1/@name"/>
                                <BR/>
                                <xsl:value-of select="IND1/DESCRIPTION"/>
                                <xsl:if test="IND1/OPTION">
                                    <TABLE WIDTH="90%" CELLPADDING="2" CELLSPACING="0" BORDER="1">
                                        <TR>
                                            <TD COLSPAN="2" BGCOLOR="#5A738C" ALIGN="CENTER">
                                                <FONT COLOR="WHITE">Vocabulary for this indicator</FONT>
                                            </TD>
                                        </TR>
                                        <xsl:for-each select="IND1/OPTION">
                                            <TR>
                                                <TD BGCOLOR="#D9E2EA" VALIGN="TOP">
                                                    <FONT SIZE="-1">
                                                        <xsl:value-of select="@value"/>
                                                    </FONT>
                                                </TD>
                                                <TD>
                                                    <FONT SIZE="-1">
                                                        <xsl:value-of select="@name"/>
                                                    </FONT>
                                                </TD>
                                            </TR>
                                        </xsl:for-each>
                                    </TABLE>
                                </xsl:if>
                            </TD>
                        </TR>
                        <!-- Second Indicator -->
                        <TR>
                            <TD BGCOLOR="#D9E2EA" VALIGN="TOP">
                                <FONT SIZE="-1">Second Indicator</FONT>
                            </TD>
                            <TD>
                                <xsl:value-of select="IND1/@name"/>
                                <BR/>
                                <xsl:value-of select="IND2/DESCRIPTION"/>
                                <xsl:if test="IND2/OPTION">
                                    <TABLE WIDTH="90%" CELLPADDING="2" CELLSPACING="0" BORDER="1">
                                        <TR>
                                            <TD COLSPAN="2" BGCOLOR="#5A738C" ALIGN="CENTER">
                                                <FONT COLOR="WHITE">Vocabulary for this indicator</FONT>
                                            </TD>
                                        </TR>
                                        <xsl:for-each select="IND2/OPTION">
                                            <TR>
                                                <TD BGCOLOR="#D9E2EA" VALIGN="TOP">
                                                    <FONT SIZE="-1">
                                                        <xsl:value-of select="@value"/>
                                                    </FONT>
                                                </TD>
                                                <TD>
                                                    <FONT SIZE="-1">
                                                        <xsl:value-of select="@name"/>
                                                    </FONT>
                                                </TD>
                                            </TR>
                                        </xsl:for-each>
                                    </TABLE>
                                </xsl:if>
                            </TD>
                        </TR>
                        <!-- Description -->
                        <TR>
                            <TD BGCOLOR="#D9E2EA" VALIGN="TOP">
                                <FONT SIZE="-1">Description</FONT>
                            </TD>
                            <TD>
                                <xsl:value-of select="DESCRIPTION"/>
                            </TD>
                        </TR>
                        <!-- Notes -->
                        <TR>
                            <TD BGCOLOR="#D9E2EA" VALIGN="TOP">
                                <FONT SIZE="-1">Notes</FONT>
                            </TD>
                            <TD>
                                <FONT SIZE="-1">
                                    <xsl:copy-of select="NOTES"/>
                                </FONT>
                            </TD>
                        </TR>
                        <!-- Start Subfields -->
                        <TR>
                            <TD COLSPAN="2" BGCOLOR="#5A738C" ALIGN="CENTER">
                                <B>
                                    <FONT COLOR="WHITE" SIZE="3">Subfields</FONT>
                                </B>
                            </TD>
                        </TR>
                        <xsl:for-each select="SUBFIELD">
                            <xsl:if test="not (@tag='*' or @tag='')">
                                <!-- Tag -->
                                <TR>
                                    <TD COLSPAN="1" BGCOLOR="#5A738C" VALIGN="TOP" ALIGN="RIGHT">
                                        <FONT COLOR="WHITE" SIZE="+1">
                                            <xsl:value-of select="' '"/>
                                            <B>
                                                <xsl:value-of select="@tag"/>
                                            </B>
                                        </FONT>
                                    </TD>
                                    <TD BGCOLOR="#5A738C">
                                        <FONT COLOR="WHITE">
                                            <B>
                                                <xsl:value-of select="@name"/>
                                            </B>
                                        </FONT>
                                    </TD>
                                </TR>
                                <!-- Mandatory -->
                                <TR>
                                    <TD BGCOLOR="#D9E2EA" VALIGN="TOP">
                                        <FONT SIZE="-1">Mandatory</FONT>
                                    </TD>
                                    <TD>
                                        <xsl:choose>
                                            <xsl:when test="@mandatory = 'y'">Yes</xsl:when>
                                            <xsl:otherwise>No</xsl:otherwise>
                                        </xsl:choose>
                                    </TD>
                                </TR>
                                <!-- Repeatable -->
                                <TR>
                                    <TD BGCOLOR="#D9E2EA" VALIGN="TOP">
                                        <FONT SIZE="-1">Repeatable</FONT>
                                    </TD>
                                    <TD>
                                        <xsl:choose>
                                            <xsl:when test="@repeatable = 'y'">Yes</xsl:when>
                                            <xsl:otherwise>No</xsl:otherwise>
                                        </xsl:choose>
                                    </TD>
                                </TR>
                            </xsl:if>
                            <!-- Description -->
                            <TR>
                                <TD BGCOLOR="#D9E2EA" VALIGN="TOP">
                                    <FONT SIZE="-1">Description</FONT>
                                </TD>
                                <TD>
                                    <xsl:value-of select="DESCRIPTION"/>
                                </TD>
                            </TR>
                            <!-- SeeEx -->
                            <xsl:if test="SEEEX">
                                <TR>
                                    <TD BGCOLOR="#D9E2EA" VALIGN="TOP">
                                        <FONT SIZE="-1">See examples</FONT>
                                    </TD>
                                    <TD>
                                        <xsl:for-each select="SEEEX">
                                            <!-- Adicionar links p cada um dos exemplos -->
                                            <A>
                                                <xsl:attribute name="HREF">#<xsl:value-of select="$FieldTag"/><xsl:value-of select="@N"/></xsl:attribute>
                                                <xsl:value-of select="@N"/>
                                                <xsl:value-of select="' '"/>
                                            </A>
                                        </xsl:for-each>
                                    </TD>
                                </TR>
                            </xsl:if>
                        </xsl:for-each>
                        <!-- End Subfields -->
                        <!-- Start Related Fields -->
                        <xsl:if test="RELATED">
                            <TR>
                                <TD COLSPAN="2" BGCOLOR="#5A738C" ALIGN="CENTER">
                                    <B>
                                        <FONT COLOR="WHITE" SIZE="3">Related Fields</FONT>
                                    </B>
                                </TD>
                            </TR>
                            <xsl:for-each select="RELATED">
                                <!-- Tag -->
                                <TR>
                                    <TD BGCOLOR="#D9E2EA" VALIGN="TOP">
                                        <FONT SIZE="-1">
                                            <xsl:value-of select="@tag"/>
                                        </FONT>
                                    </TD>
                                    <!-- name & Description -->
                                    <TD>
                                        <FONT SIZE="-1">
                                            <xsl:value-of select="@name"/>
                                            <BR/>
                                            <xsl:value-of select="DESCRIPTION"/>
                                        </FONT>
                                    </TD>
                                </TR>
                            </xsl:for-each>
                        </xsl:if>
                        <!-- End Related Fields -->
                        <!-- Start Examples -->
                        <xsl:if test="EXAMPLES">
                            <TR>
                                <TD COLSPAN="2" BGCOLOR="#5A738C" ALIGN="CENTER">
                                    <B>
                                        <FONT COLOR="WHITE" SIZE="3">Examples</FONT>
                                    </B>
                                </TD>
                            </TR>
                            <xsl:for-each select="EXAMPLES/EX">
                                <TR>
                                    <!-- Number and description -->
                                    <TD BGCOLOR="#D9E2EA" VALIGN="TOP">
                                        <FONT SIZE="-1">
                                            <!-- Atribuir um nome a cada um dos exemplos -->
                                            <!-- O nome do exemplo e composto pelos digitos do campo -->
                                            <!-- e pelo numero do exemplo -->
                                            <A>
                                                <xsl:attribute name="NAME"><xsl:value-of select="$FieldTag"/><xsl:value-of select="@n"/></xsl:attribute>
                                                <xsl:value-of select="@n"/>
                                            </A>
                                        </FONT>
                                    </TD>
                                    <TD>
                                        <FONT SIZE="-1">
                                            <xsl:copy-of select=".|*"/>
                                        </FONT>
                                    </TD>
                                </TR>
                            </xsl:for-each>
                        </xsl:if>
                        <!-- End Examlpes -->
                    </TABLE>
                    <HR/>
                </xsl:for-each>
                <!-- End fields -->
            </BODY>
        </HTML>
    </xsl:template>
</xsl:stylesheet>
