Page 1 of 1

Error while searching for text in the topic title

Posted: Fri Dec 17, 2021 2:29 pm
by Kot_1977
I use:
oXygen XML Editor 22.1, build 2020100710
transformation scenario - DITA Map PDF - based on XSL-FO
customization directory - according to oXygen's instructions.

Via custom.xsl I'm looking for topics that have equation.
Then I look for titles of such topics.
Among them, I'm looking for titles that start with "Appendix".
But i'm getting an error in oXygen: A sequence of more than one item is not allowed as the first argument of starts-with() ("", "").
How to fix it?

Thanks in advance!

Code: Select all

    <xsl:template match="*[contains(@class, ' equation-d/equation-block ')]">
        <xsl:variable name="title" select="ancestor::concept/title"/>
        <xsl:if test="$title= starts-with(text(), 'Appendix')">
        ...
       </xsl:if>
   </xsl:template>

Re: Error while searching for text in the topic title

Posted: Fri Dec 17, 2021 3:16 pm
by Radu
Hi,

Let's say the <title> looks like this:

Code: Select all

<title>abc<b>bold content</b>def</title>
An xpath like this text() returns two text nodes "abc" and "def". So it returns a sequence of strings and it also skips over the text inside the "b" element.
But the method "starts-with" takes an atomic string value as the first parameter not a sequence of strings.
You could maybe use something like this:

Code: Select all

starts-with(string-join(.//text(), ''), 'Appendix')
Regards,
Radu