1
votes

I've the below XML in my XSLT.

 <section level="sect4" number-type="manual" num="(ii)">
        <title>
            Non-Hong Kong companies
            <footnote num="123">
                <para>The venerable statutory .</para>
            </footnote> with a place of business in Hong Kong
            <footnote num="124">
                <para>It may be noted in this context of English judgments.</para>
            </footnote>
        </title>
        <para>
            <phrase>3.039</phrase> Companies incorporal Companies,
            <footnote num="125">
                <para>Registration of the information specified in this
                 section must be effected</para>
            </footnote>
            of which three are relevant for present purposes:
        </para>
    </section>

here i want to apply-templates but ignore the footnotes, when i use the below.

    <xsl:template name="IndexItem">
    <xsl:if test="not(contains(@level,'sect1'))"><!--changed fron @num to sect2-->
        <xsl:variable name="tocpg">
            <xsl:value-of select="concat('#P',descendant::phrase[1])"/>
        </xsl:variable>
        <xsl:variable name="nu">
        <xsl:number format="(i)"/>
        </xsl:variable>
        <xsl:variable name="tocpgtag" select="translate($tocpg,'.', '-')"/>
        <xsl:variable name="smallcase" select="'abcdefghijklmnopqrstuvwxyz'"/>
        <xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
        <xsl:variable name="text" select="current()/title/text()"/>
        <xsl:variable name="Brac">
            <xsl:choose>
                <xsl:when test="contains(current()/@num,$nu)">
                    <xsl:value-of select="3"/>
                </xsl:when>
                <xsl:when test="contains(current()/@num,'(')">
                    <xsl:value-of select="2"/>
                </xsl:when>
                <xsl:otherwise>
                                    <xsl:value-of select="1"/>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:variable>
        <xsl:variable name="d">
        <xsl:value-of select="concat('toc-item-',$ThisDocument//ntw:nums[@num=$Brac]/@word,'-level')"/>
</xsl:variable>
        <table class="{$d}">
            <tbody>
                <tr>
                    <td class="toc-item-num">
                        <xsl:value-of select="@num"/>
                    </td>
                    <td class="toc-title">
                     <xsl:apply-templates select="node() except child::footnote"/>
                    </td>
                    <td class="toc-pg">
                        <a href="{$tocpgtag}">
                            <xsl:value-of select="descendant::phrase[1]"/><![CDATA[ ]]>
                        </a>
                    </td>
                </tr>
            </tbody>
        </table>
        </xsl:if>
    </xsl:template>

the output is

Non-Hong Kong companies <sup>123</sup>  with a place of business in Hong Kong <sup>124</sup>

and when i use this

<xsl:apply-templates select="./title[not(./footnote)]"/>

it is not displaying anything, the expected output is, just

Non-Hong Kong companies with a place of business in Hong Kong

and also if there are anymore other childs(like content style), they should be applied, only footnote is to be ignored.

please let me know how can i do this.

Thanks

1

1 Answers

1
votes

you could try the except operator:

<xsl:template match="title">
    <xsl:apply-templates select="node() except child::footnote"/>
</xsl:template>

EDIT

I am inferring that you are calling this template from the section node. Try this instead:

<xsl:apply-templates select="title/node() except descendant::footnote"/>