common.xsl
branchstyles
changeset 0 08de8d15f932
equal deleted inserted replaced
-1:000000000000 0:08de8d15f932
       
     1 <?xml version="1.0"?>
       
     2 <xsl:stylesheet version="1.1"
       
     3   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
       
     4   xmlns:xt="http://www.jclark.com/xt"
       
     5   extension-element-prefixes="xt">
       
     6   
       
     7 <xsl:template name="get-id">    
       
     8   <xsl:choose>
       
     9     <xsl:when test="@id"><xsl:value-of select="@id"/></xsl:when>
       
    10     <xsl:otherwise><xsl:value-of select="generate-id(.)"/></xsl:otherwise>
       
    11   </xsl:choose>
       
    12 </xsl:template>
       
    13 <xsl:template name="parent-id">
       
    14   <xsl:choose>
       
    15     <xsl:when test="../@id"><xsl:value-of select="../@id"/></xsl:when>
       
    16     <xsl:otherwise><xsl:value-of select="generate-id(..)"/></xsl:otherwise>
       
    17   </xsl:choose>
       
    18 </xsl:template>
       
    19 <xsl:template name="next-id">
       
    20   <xsl:choose>
       
    21     <xsl:when test="following::*[1]/@id"><xsl:value-of select="following::*[1]/@id"/></xsl:when>
       
    22     <xsl:otherwise><xsl:value-of select="generate-id(following::*[1])"/></xsl:otherwise>
       
    23   </xsl:choose>
       
    24 </xsl:template>
       
    25 <xsl:template name="prec-id">
       
    26   <xsl:choose>
       
    27     <xsl:when test="preceding::*[1]/@id"><xsl:value-of select="preceding::*[1]/@id"/></xsl:when>
       
    28     <xsl:otherwise><xsl:value-of select="generate-id(preceding::*[1])"/></xsl:otherwise>
       
    29   </xsl:choose>
       
    30 </xsl:template>
       
    31 
       
    32 <xsl:template match="*" mode="fullname">
       
    33   <xsl:call-template name="name"/>  
       
    34 </xsl:template>
       
    35 
       
    36 <!-- default docinfo processing -->
       
    37 <!-- normal is not process -->
       
    38 <xsl:template match="docinfo"/>
       
    39 
       
    40 <!-- copyright footer processing -->
       
    41 <xsl:template match="copyright">
       
    42   © <xsl:apply-templates select="holder"/>
       
    43   <xsl:text> </xsl:text>
       
    44   <xsl:apply-templates select="year"/>
       
    45 </xsl:template>
       
    46 <xsl:template match="holder">
       
    47   <xsl:call-template name="name"/>
       
    48 </xsl:template>
       
    49 <xsl:template match="year">
       
    50   <xsl:apply-templates/>
       
    51   <xsl:if test="position() != last()">
       
    52     <xsl:text>, </xsl:text>
       
    53   </xsl:if>
       
    54 </xsl:template>
       
    55 
       
    56 <!-- author processing -->
       
    57 <xsl:template match="author">
       
    58   <xsl:call-template name="name"/> 
       
    59 </xsl:template>
       
    60 
       
    61 <!-- short representation -->
       
    62 <xsl:template match="para" mode="short">
       
    63   <xsl:apply-templates/>  
       
    64 </xsl:template>
       
    65 <xsl:template match="list" mode="short">
       
    66   <xsl:param name="ending">
       
    67     <xsl:text>.</xsl:text>
       
    68   </xsl:param>
       
    69   <xsl:apply-templates mode="short">
       
    70     <xsl:with-param name="ending" select="$ending"/>
       
    71   </xsl:apply-templates>
       
    72 </xsl:template>
       
    73 <xsl:template match="listitem" mode="short">
       
    74   <xsl:apply-templates mode="short"/><xsl:text>, </xsl:text>
       
    75 </xsl:template>
       
    76 <xsl:template match="listitem[position() = last()]" mode="short">
       
    77   <xsl:param name="ending">
       
    78     <xsl:text>.</xsl:text>
       
    79   </xsl:param>
       
    80   <xsl:apply-templates mode="short"/><xsl:value-of select="$ending"/>
       
    81 </xsl:template>
       
    82 <xsl:template match="item" mode="short">
       
    83   <xsl:apply-templates/><xsl:text>, </xsl:text>
       
    84 </xsl:template>
       
    85 <xsl:template match="item[position() = last()]" mode="short">
       
    86   <xsl:param name="ending">
       
    87     <xsl:text>.</xsl:text>
       
    88   </xsl:param>
       
    89   <xsl:apply-templates/><xsl:value-of select="$ending"/>
       
    90 </xsl:template>
       
    91 
       
    92 </xsl:stylesheet>
       
    93