[oXygen-user] Need help with a Schematron rule
David Maus
lists at dmaus.name
Wed Feb 14 03:02:31 CST 2024
Moin!
On Wed, 14 Feb 2024 09:48:18 +0100,
Frank Dissinger wrote:
>
> [1 <multipart/alternative (7bit)>]
> [1.1 <text/plain; UTF-8 (8bit)>]
> [1.2 <text/html; UTF-8 (8bit)>]
> Hi all,
>
> I want to write a Schematron rule which checks whether a keyref'ed element contains a blank character.
>
> WRONG: <ph keyref="mykey"> </ph>
>
> CORRECT: <ph keyref="mykey"></ph>
>
> I adapted another rule and tried the following, but it does not work as expected.
> In addition, it should apply to any keyref'ed element, not only to <ph>.
>
> <sch:pattern id="Check_blanks" xmlns:sch="http://purl.oclc.org/dsdl/schematron">
> <sch:rule context="*[contains(@class, 'ph')][@keyref]">
> <sch:assert test="not(contains(text(), ' '))">No blank allowed inside keyref'ed ph elements</sch:assert>
> </sch:rule>
> </sch:pattern>
Your rule matches all elements with @keyref and with an @class
attribute that contains 'ph'.
The two examples do not have a @class attribute, thus the rule doesn't
fire.
Maybe rewrite the rule as
sch:rule context="*[@keyref]"?
HTH,
-- David
>
> Any help would be greatly appreciated.
>
> Regards,
>
> Frank
>
> --
>
> Frank Dissinger
>
> Documentation Manager
>
> ....................................................................
>
> CGS ORIS GmbH
>
> Email frank.dissinger at cgs-oris.com | Web www.cgs-oris.com
>
> Address Kettelerstr. 24 | D-63512 Hainburg | Germany
>
> Phone +49 6182 9626-27 | Fax +49 6182 9626-99
>
> Commercial register Offenbach, HRB no. 21495
>
> Managing directors Bernd Rückert, Christoph Thommessen
>
> https://www.cgs-oris.com/Signatur.png
> [2 <text/plain; us-ascii (7bit)>]
> _______________________________________________
> oXygen-user mailing list
> oXygen-user at oxygenxml.com
> https://www.oxygenxml.com/mailman/listinfo/oxygen-user
--
David Maus
Hamburg, Germany
web: https://dmaus.name
fediverse: @dmaus at dmaus.name
More information about the oXygen-user
mailing list