Error while searching for text in the topic title

Post here questions and problems related to editing and publishing DITA content.
Kot_1977
Posts: 16
Joined: Thu Dec 10, 2020 11:00 am

Error while searching for text in the topic title

Post 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>
Radu
Posts: 9434
Joined: Fri Jul 09, 2004 5:18 pm

Re: Error while searching for text in the topic title

Post 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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply