|
Subject: Re: [xsl] tricky text and structure test is troubling me From: "Liam R. E. Quin liam@xxxxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Fri, 6 Mar 2020 17:28:01 -0000 |
On Fri, 2020-03-06 at 16:39 +0000, Trevor Nicholls
trevor@xxxxxxxxxxxxxxxxxx wrote:
> [...]
>
> The number of such elements is finite, in fact off the top of my head
> targets and footnotes are the only ones.
Some quick thoughts:
Consider writing a template mode that will remove footnote and target
elements, and will replace an "include" element by its contents (and
process that recursively with apply-templates of course).
(in XSLT 3 it can be a separate stylesheet invoked with fn:transform()
instead of a mode, which makes for easier testing)
So then it's a case of selecting everything before the first section
element - maybe in the template for title:
<xsl:if test="z:has-text(
following-sibling::*[
not(
self::section or preceding-sibling::section
)
] ) />
Now, z:has-text is a function you write that takes a list of elements
(note: if you need to match text nodes as well, it's probably easier to
use the << and >> operators on node()).
It'll pre-process them to remove footnotes etc., and then do something
like,
<xsl:sequence select="not( empty( $proprocessed-nodes//text() ) )" />
to return true or false.
Liam
--
Liam Quin, https://www.delightfulcomputing.com/
Available for XML/Document/Information Architecture/XSLT/
XSL/XQuery/Web/Text Processing/A11Y training, work & consulting.
Barefoot Web-slave, antique illustrations: http://www.fromoldbooks.org
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] tricky text and structure, Trevor Nicholls trev | Thread | [xsl] JSON to XSLT to create AdobeI, James Grubb james@xx |
| Re: [xsl] tricky text and structure, Trevor Nicholls trev | Date | Re: [xsl] group-starting-with and e, Mukul Gandhi gandhi. |
| Month |