From: <bob...@us...> - 2013-09-13 18:43:44
|
Revision: 9807 http://sourceforge.net/p/docbook/code/9807 Author: bobstayton Date: 2013-09-13 18:43:40 +0000 (Fri, 13 Sep 2013) Log Message: ----------- Pass referrer and target params to mode="xrefstyle" to allow customizations to be more specific. Modified Paths: -------------- trunk/xsl/common/common.xsl trunk/xsl/common/olink.xsl trunk/xsl/common/titles.xsl trunk/xsl/fo/xref.xsl trunk/xsl/html/xref.xsl Modified: trunk/xsl/common/common.xsl =================================================================== --- trunk/xsl/common/common.xsl 2013-09-13 18:04:54 UTC (rev 9806) +++ trunk/xsl/common/common.xsl 2013-09-13 18:43:40 UTC (rev 9807) @@ -2108,6 +2108,12 @@ </xsl:template> <xsl:template match="*" mode="xrefstyle"> + <xsl:param name="referrer" select="."/> + <xsl:param name="target"/> + <xsl:param name="olink.key"/> + + <!-- normally uses the @xrefstyle attribute in xref, but could + be customized based on the target element type --> <xsl:choose> <xsl:when test="@role and not(@xrefstyle) and $use.role.as.xrefstyle != 0"> Modified: trunk/xsl/common/olink.xsl =================================================================== --- trunk/xsl/common/olink.xsl 2013-09-13 18:04:54 UTC (rev 9806) +++ trunk/xsl/common/olink.xsl 2013-09-13 18:43:40 UTC (rev 9807) @@ -640,7 +640,10 @@ <xsl:param name="olink.key" select="''"/> <xsl:param name="referrer" select="."/> <xsl:param name="xrefstyle"> - <xsl:apply-templates select="." mode="xrefstyle"/> + <xsl:apply-templates select="." mode="xrefstyle"> + <xsl:with-param name="olink.key" select="$olink.key"/> + <xsl:with-param name="referrer" select="$referrer"/> + </xsl:apply-templates> </xsl:param> <xsl:choose> @@ -1071,10 +1074,14 @@ <xsl:template name="olink.page.citation"> <xsl:param name="olink.key" select="''"/> <xsl:param name="olink.lang" select="'en'"/> + <xsl:param name="referrer" select="."/> <xsl:param name="target.database"/> <xsl:param name="linkend" select="''"/> <xsl:param name="xrefstyle"> - <xsl:apply-templates select="." mode="xrefstyle"/> + <xsl:apply-templates select="." mode="xrefstyle"> + <xsl:with-param name="olink.key" select="$olink.key"/> + <xsl:with-param name="referrer" select="$referrer"/> + </xsl:apply-templates> </xsl:param> <xsl:variable name="targetdoc"> @@ -1122,11 +1129,15 @@ </xsl:template> <xsl:template name="olink.document.citation"> + <xsl:param name="referrer" select="."/> <xsl:param name="olink.key" select="''"/> <xsl:param name="olink.lang" select="'en'"/> <xsl:param name="target.database"/> <xsl:param name="xrefstyle"> - <xsl:apply-templates select="." mode="xrefstyle"/> + <xsl:apply-templates select="." mode="xrefstyle"> + <xsl:with-param name="olink.key" select="$olink.key"/> + <xsl:with-param name="referrer" select="$referrer"/> + </xsl:apply-templates> </xsl:param> <xsl:variable name="page"> @@ -1186,10 +1197,14 @@ <xsl:template name="xref.page.citation"> <!-- Determine if this xref should have a page citation. Context node is the xref or local olink element --> + <xsl:param name="referrer" select="."/> <xsl:param name="linkend" select="@linkend"/> <xsl:param name="target" select="key('id', $linkend)"/> <xsl:param name="xrefstyle"> - <xsl:apply-templates select="." mode="xrefstyle"/> + <xsl:apply-templates select="." mode="xrefstyle"> + <xsl:with-param name="target" select="$target"/> + <xsl:with-param name="referrer" select="$referrer"/> + </xsl:apply-templates> </xsl:param> <xsl:if test="not(starts-with(normalize-space($xrefstyle),'select:') Modified: trunk/xsl/common/titles.xsl =================================================================== --- trunk/xsl/common/titles.xsl 2013-09-13 18:04:54 UTC (rev 9806) +++ trunk/xsl/common/titles.xsl 2013-09-13 18:43:40 UTC (rev 9807) @@ -736,11 +736,15 @@ </xsl:template> <xsl:template match="xref" mode="no.anchor.mode"> + <xsl:variable name="referrer" select="."/> <xsl:variable name="targets" select="key('id',@linkend)|key('id',substring-after(@xlink:href,'#'))"/> <xsl:variable name="target" select="$targets[1]"/> <xsl:variable name="refelem" select="local-name($target)"/> <xsl:variable name="xrefstyle"> - <xsl:apply-templates select="." mode="xrefstyle"/> + <xsl:apply-templates select="." mode="xrefstyle"> + <xsl:with-param name="target" select="$target"/> + <xsl:with-param name="referrer" select="$referrer"/> + </xsl:apply-templates> </xsl:variable> <xsl:call-template name="check.id.unique"> Modified: trunk/xsl/fo/xref.xsl =================================================================== --- trunk/xsl/fo/xref.xsl 2013-09-13 18:04:54 UTC (rev 9806) +++ trunk/xsl/fo/xref.xsl 2013-09-13 18:43:40 UTC (rev 9807) @@ -56,8 +56,12 @@ <xsl:param name="linkend.targets" select="key('id',@linkend)"/> <xsl:param name="target" select="($xlink.targets | $linkend.targets)[1]"/> <xsl:param name="refelem" select="local-name($target)"/> + <xsl:param name="referrer" select="."/> <xsl:param name="xrefstyle"> - <xsl:apply-templates select="." mode="xrefstyle"/> + <xsl:apply-templates select="." mode="xrefstyle"> + <xsl:with-param name="target" select="$target"/> + <xsl:with-param name="referrer" select="$referrer"/> + </xsl:apply-templates> </xsl:param> <xsl:variable name="content"> @@ -155,10 +159,14 @@ <xsl:template match="biblioref" name="biblioref"> <xsl:variable name="targets" select="key('id',@linkend)"/> <xsl:variable name="target" select="$targets[1]"/> + <xsl:variable name="referrer" select="."/> <xsl:variable name="refelem" select="local-name($target)"/> <xsl:variable name="xrefstyle"> - <xsl:apply-templates select="." mode="xrefstyle"/> + <xsl:apply-templates select="." mode="xrefstyle"> + <xsl:with-param name="target" select="$target"/> + <xsl:with-param name="referrer" select="$referrer"/> + </xsl:apply-templates> </xsl:variable> <xsl:call-template name="check.id.unique"> @@ -852,11 +860,15 @@ <!-- ==================================================================== --> <xsl:template match="link" name="link"> + <xsl:param name="referrer" select="."/> <xsl:param name="linkend" select="@linkend"/> <xsl:param name="targets" select="key('id',$linkend)"/> <xsl:param name="target" select="$targets[1]"/> <xsl:param name="xrefstyle"> - <xsl:apply-templates select="." mode="xrefstyle"/> + <xsl:apply-templates select="." mode="xrefstyle"> + <xsl:with-param name="target" select="$target"/> + <xsl:with-param name="referrer" select="$referrer"/> + </xsl:apply-templates> </xsl:param> <xsl:variable name="content"> Modified: trunk/xsl/html/xref.xsl =================================================================== --- trunk/xsl/html/xref.xsl 2013-09-13 18:04:54 UTC (rev 9806) +++ trunk/xsl/html/xref.xsl 2013-09-13 18:43:40 UTC (rev 9807) @@ -52,9 +52,13 @@ <xsl:param name="xlink.targets" select="key('id',$xlink.idref)"/> <xsl:param name="linkend.targets" select="key('id',@linkend)"/> <xsl:param name="target" select="($xlink.targets | $linkend.targets)[1]"/> + <xsl:param name="referrer" select="."/> <xsl:param name="xrefstyle"> - <xsl:apply-templates select="." mode="xrefstyle"/> + <xsl:apply-templates select="." mode="xrefstyle"> + <xsl:with-param name="target" select="$target"/> + <xsl:with-param name="referrer" select="$referrer"/> + </xsl:apply-templates> </xsl:param> <xsl:call-template name="anchor"/> @@ -132,8 +136,12 @@ <xsl:variable name="targets" select="key('id',@linkend)"/> <xsl:variable name="target" select="$targets[1]"/> <xsl:variable name="refelem" select="local-name($target)"/> + <xsl:variable name="referrer" select="."/> <xsl:variable name="xrefstyle"> - <xsl:apply-templates select="." mode="xrefstyle"/> + <xsl:apply-templates select="." mode="xrefstyle"> + <xsl:with-param name="target" select="$target"/> + <xsl:with-param name="referrer" select="$referrer"/> + </xsl:apply-templates> </xsl:variable> <xsl:call-template name="check.id.unique"> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |