<!--

# =============================================================================

# Copyright © 2016 Typéfi Systems. All rights reserved.

#

# Unless required by applicable law or agreed to in writing, software

# is distributed on an "as is" basis, without warranties or conditions of any

# kind, either express or implied.

# =============================================================================

-->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tps="http://www.typefi.com/ContentXML" xmlns:xd="http://www.pnp-software.com/XSLTdoc" version="2.0" exclude-result-prefixes="#all">





    
    <xd:doc type="stylesheet">

        
<xd:short>

            Dedicated module for conversion of 
<xd:xml><xref /></xd:xml> and corresponding configuration.

        
</xd:short>

        
<xd:cvsId>   $Revision$</xd:cvsId>

    
</xd:doc>






    
<xsl:template match="xref[tps:transformable-as-doclink(.) and tps:transformed-to-doclink(.)]" priority="10">

        
<tps:doclink refType="paragraph" refId="{@rid}">

            
<xsl:apply-templates />

        
</tps:doclink>

    
</xsl:template>





    
<!-- @Description:  Defines whether a particular xref element was configured to be transformed

                        to Typefi doclink. 
-->

    
<xsl:function name="tps:transformed-to-doclink" as="xs:boolean">

        
<xsl:param name="xref" as="element(xref)" />



        
<xsl:sequence select="$xref/@ref-type = $xref.to.doclink.types" />

    
</xsl:function>





    
<!-- @Description:  Defines whether a particular xref element can be transformed to Typefi

                        doclink. Basically, the limitations are caused by how the Core handles

                        input IDs — only some are passed to CXML. 
-->

    
<xsl:function name="tps:transformable-as-doclink" as="xs:boolean">

        
<xsl:param name="xref" as="element(xref)" />



        
<xsl:sequence select="$xref/@ref-type = ('aff', 'app', 'bibr', 'boxed-text', 'corresp', 'disp-formula', 'fig', 'list', 'table')" />

    
</xsl:function>



</xsl:stylesheet>













































































v