--- /dev/null
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:exsl="http://exslt.org/common"
+ exclude-result-prefixes="exsl"
+ version="1.0">
+
+ <xsl:output method="xml"
+ encoding="US-ASCII"
+ indent="yes"/>
+ <xsl:preserve-space elements="*"/>
+
+ <!-- textify.xsl - Make "textified" copies of templates from a stylesheet. -->
+
+ <!-- $Id -->
+
+ <!-- This stylesheet is currently only used as part of the build for -->
+ <!-- DocBook manpages releases. It creates a manpages/xref.xsl stylesheet -->
+ <!-- containing transformed copies of templates for processing the "xref" -->
+ <!-- and "olink" templates. -->
+
+ <xsl:template match="/">
+ <xsl:text> </xsl:text>
+ <xsl:comment> * This file was created automatically by textify.xsl </xsl:comment>
+ <xsl:text> </xsl:text>
+ <xsl:comment> * as part of the DocBook manpages stylesheet build </xsl:comment>
+ <xsl:text> </xsl:text>
+ <xsl:comment> * </xsl:comment>
+ <xsl:text> </xsl:text>
+ <xsl:comment> * DocBook Project developers: DO NOT EDIT THIS FILE. </xsl:comment>
+ <xsl:text> </xsl:text>
+ <xsl:comment> * </xsl:comment>
+ <xsl:text> </xsl:text>
+ <xsl:comment> * Instead, edit a source stylesheet and then re-run </xsl:comment>
+ <xsl:text> </xsl:text>
+ <xsl:comment> * textify.xsl to generate a new version of this file. </xsl:comment>
+ <xsl:text> </xsl:text>
+ <xsl:apply-templates/>
+ <xsl:text> </xsl:text>
+ </xsl:template>
+
+ <xsl:template match="xsl:stylesheet" >
+ <xsl:copy>
+ <xsl:copy-of select="@*"/>
+ <xsl:apply-templates/>
+ </xsl:copy>
+ </xsl:template>
+
+ <xsl:template match="xsl:output">
+ <xsl:copy>
+ <xsl:copy-of select="@*"/>
+ <xsl:attribute name="method">xml</xsl:attribute>
+ <xsl:attribute name="encoding">UTF-8</xsl:attribute>
+ </xsl:copy>
+ </xsl:template>
+
+ <xsl:template match="*">
+ <xsl:copy>
+ <xsl:copy-of select="@*"/>
+ <xsl:apply-templates/>
+ </xsl:copy>
+ </xsl:template>
+
+ <!-- copy a template but transform it such that, when the copy is used, it -->
+ <!-- takes the content which the original template would have output and -->
+ <!-- instead reads into a variable which it then runs through -->
+ <!-- "replace-entities" template -->
+
+ <!-- the main purpose of this change is to make it possible to replace -->
+ <!-- entities in output of xrefs and onlinks -->
+ <xsl:template match="xsl:template">
+ <xsl:choose>
+ <xsl:when test="
+ @match = 'xref' or
+ @match = 'olink'
+ ">
+ <xsl:copy>
+ <xsl:copy-of select="@*"/>
+ <xsl:element name="xsl:variable">
+ <xsl:attribute name="name">content</xsl:attribute>
+ <xsl:apply-templates/>
+ </xsl:element>
+ <xsl:element name="xsl:call-template">
+ <xsl:attribute name="name">replace-entities</xsl:attribute>
+ <xsl:element name="xsl:with-param">
+ <xsl:attribute name="name">content</xsl:attribute>
+ <xsl:attribute name="select">$content</xsl:attribute>
+ </xsl:element>
+ </xsl:element>
+ </xsl:copy>
+ </xsl:when>
+ <xsl:otherwise/>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="processing-instruction()">
+ <xsl:copy/>
+ </xsl:template>
+
+ <xsl:template match="comment()|text()"/>
+
+</xsl:stylesheet>
+++ /dev/null
-<?xml version='1.0'?>
-<!-- vim:set sts=2 shiftwidth=2 syntax=sgml: -->
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- version='1.0'>
-
-<xsl:template match="xref">
- <xsl:variable name="targets" select="key('id', @linkend)"/>
- <xsl:variable name="target" select="$targets[1]"/>
- <xsl:variable name="type" select="local-name($target)"/>
-
- <xsl:choose>
- <xsl:when test="$type=''">
- <xsl:message>
- <xsl:text>xref to nonexistent id </xsl:text>
- <xsl:value-of select="@linkend"/>
- </xsl:message>
- </xsl:when>
-
- <xsl:when test="$type='refentry'">
- <xsl:call-template name="do-citerefentry">
- <xsl:with-param name="refentrytitle"
- select="$target/refmeta/refentrytitle[1]"/>
- <xsl:with-param name="manvolnum"
- select="$target/refmeta/manvolnum"/>
- </xsl:call-template>
- </xsl:when>
-
- <xsl:when test="$type='refname'">
- <xsl:call-template name="do-citerefentry">
- <xsl:with-param name="refentrytitle" select="$target"/>
- <xsl:with-param name="manvolnum"
- select="$target/../../refmeta/manvolnum"/>
- </xsl:call-template>
- </xsl:when>
-
- <xsl:otherwise>
- <xsl:text>[xref to </xsl:text>
- <xsl:value-of select="$type"/>
- <xsl:text>]</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
-</xsl:template>
-
-</xsl:stylesheet>