Xpath for validating if href in xref element is pointing to <fn> element #XSLT


Shaurabh
 

I have a test.dita file which consists of a table element as shown below. As you can see few cells inside <tgroup> element consists of xref element which are targeting to <fn> element. I want to have total count of <xref> elements targeting to <fn> element.
I am able to have the count of xref elements having href attribute using below xpath-

<xsl:variable name="prmElement" select="."/>
<xsl:variable name="fnXCount" select="count($prmElement/descendant::*[contains(@class,' topic/xref ')][@href])"/>

In addition to above, I want to validate if @href is pointing to <fn> element.  Please help me to improve above xpath for fn count validation.
test.dita

<topic id="test_overview">
    <title id="title_id">Test Title</title>
    <body>
        <table>
            <title>My table</title>
            <desc>
                <p>
                    <fn id="fn_5fc">My first footnote.</fn>
                </p>
                <p>
                    <fn id="fn_vfc">My second footnote.</fn>
                </p>
            </desc>
            <tgroup cols="3">
                <colspec colname="col1" colwidth="1.01*" colnum="1"/>
                <colspec colname="col4" colwidth="1.01*" colnum="2"/>
                <colspec colname="col5" colwidth="1*" colnum="3"/>
                <thead>
                    <row>
                        <entry>Col1</entry>
                        <entry>Col2</entry>
                        <entry>Col3</entry>
                    </row>
                </thead>
                <tbody>
                    <row>
                        <entry align="center">Cell <xref
                                href="test.dita#test_overview/fn_5fc"
                            />
                        </entry>
                        <entry align="center">Cell <xref
                                href="test.dita#test_overview/fn_5fc"
                            />
                        </entry>
                        <entry align="center">Cell <xref
                                href="test.dita#test_overview/fn_vfc"
                            />
                        </entry>
                    </row>
                </tbody>
            </tgroup>
        </table>
    </body>
</topic>
 


Regards,
Shaurabh

Join main@dita-users.groups.io to automatically receive all group messages.