VirtualBox

Changeset 98671 in vbox for trunk/doc


Ignore:
Timestamp:
Feb 21, 2023 12:06:11 PM (22 months ago)
Author:
vboxsync
Message:

Docs: bugref:10302. Add an template to xslt proprocessing to mark xref as external when they point to some external URL.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/manual/refsect2_replace.xsl

    r98604 r98671  
    11<!--
    22    refsect2_replace.xsl:
    3         Replaces refsect2 elements with corresponding refsect1.
     3        - Replaces refsect2 elements with corresponding refsect1. It looks
     4        like dita does not like nested refsect sections. So we flat them out.
     5        - When href attribute of a xref element has http in its value
     6        then add scope="external" attribute to that element. This attribute
     7        tells dita pdf output java stuff not to retrieve and parse those documents.
    48-->
    59<!--
     
    2630<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    2731    <xsl:output encoding="UTF-8" method="xml" omit-xml-declaration="no" indent="yes" />
    28     <xsl:output doctype-system="http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"
    29          doctype-public="-//OASIS//DTD DocBook XML V4.5//EN"/>
     32    <xsl:output doctype-system="http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" doctype-public="-//OASIS//DTD DocBook XML V4.5//EN"/>
    3033
    3134    <xsl:template match="refsect2">
    3235        <xsl:element name="refsect1">
    3336            <xsl:for-each select="@*">
    34                 <xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>
     37                <xsl:attribute name="{name()}">
     38                    <xsl:value-of select="." />
     39                </xsl:attribute>
    3540            </xsl:for-each>
    3641            <xsl:copy-of select="node()"/>
    3742        </xsl:element>
    3843    </xsl:template>
     44
    3945    <xsl:template match="node()|@*">
    4046        <xsl:copy>
     
    4248        </xsl:copy>
    4349    </xsl:template>
     50
     51
     52    <xsl:template match="xref">
     53        <xsl:choose>
     54            <xsl:when test="contains(@href, 'http')">
     55                <xsl:copy>
     56                    <xsl:attribute name="scope">external</xsl:attribute>
     57                    <xsl:apply-templates select="@*|node()"/>
     58                </xsl:copy>
     59            </xsl:when>
     60            <xsl:otherwise>
     61                <xsl:copy-of select="."/>
     62            </xsl:otherwise>
     63        </xsl:choose>
     64    </xsl:template>
    4465</xsl:stylesheet>
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette