speedata / publisher

speedata Publisher - a professional database Publishing system
https://www.speedata.de/
GNU Affero General Public License v3.0
296 stars 36 forks source link

Adjust schema for NoBreak to make it work within ForAll, Case, etc. #356

Closed dark-m0de closed 2 years ago

dark-m0de commented 2 years ago

I was struggling quite some time to dynamically create a <NoBreak> node within a Paragraph. As per the current schema definition, <NoBreak> is only allowed within the following elements:

A
B
Color
Fontface
I
Li
Paragraph
Span
U
URL

In the end I added a <Span> to make the <NoBreak> work within <ForAll> loop:

<Record element="p">
    <Output area="content">
        <Text>
            <Paragraph fontfamily="text" padding-left="{$text-padding-left}" padding-right="{$text-padding-right}" html="all">
                <ForAll select="node()">
                    <Switch>
                        <Case test="local-name() = 'nobr'">
                            <Span>
                                <NoBreak>
                                    <Value select="." />
                                </NoBreak>
                            </Span>
                        </Case>
                        <Otherwise>
                            <Value select="." />
                        </Otherwise>
                    </Switch>
                </ForAll>
            </Paragraph>
        </Text>
    </Output>
</Record>

From a little experiment with the schema file, I also know that <NoBreak> would work without <Span> in this case.

May I therefore kindly ask to rethink the current schema structure for <NoBreak>? It would be great to have similar flexibility like with <A>, <B> etc.