Use the following XPath expression:
/*/h:body//h:h1
|
/*/h:body//h:h1/following::node()
[count(. | //h:table[@id='toc']
/preceding::node()
)
=
count(//h:table[@id='toc']
/preceding::node()
)
]
İşte öneki h:
XHTML ad bağlı ("http://www.w3.org/1999/xhtml"
).
This transformation shows that the wanted result is really produced:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:h="http://www.w3.org/1999/xhtml"
>
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:template match="/">
<xsl:copy-of select=
"/*/h:body//h:h1
|
/*/h:body//h:h1/following::node()
[count(. | //h:table[@id='toc']
/preceding::node()
)
=
count(//h:table[@id='toc']
/preceding::node()
)
]
"/>
</xsl:template>
</xsl:stylesheet>
When run on the XHTML document of the Wikipedia article (ayrıca bu belge için iki tarafını
ve ®
tanımlamanız gerekir), istenen sonuç elde edilir.