shorten a XPATH expression (or-junction)

Questions about XML that are not covered by the other forums should go here.
mariomueller
Posts: 30
Joined: Wed Feb 14, 2018 3:27 pm

shorten a XPATH expression (or-junction)

Post by mariomueller » Wed Feb 14, 2018 3:33 pm

Hi all,

is there a way to write to expression

Code: Select all

<xsd:assert test="(G_SG8/G_SG10/S_CCI[D_7059='Z01']/D_4051='Z30') or (G_SG8/G_SG10/S_CCI[D_7059='Z01']/D_4051='Z31') " />
in a shorter way like e.g. (the following is not working, as also Z99 would be valid and I don't no why?)

Code: Select all

<xsd:assert test="G_SG8/G_SG10/S_CCI[D_7059='Z01']/D_4051='Z30' or 'Z31' " />

Thanks
Regards
Mario

adrian
Posts: 2580
Joined: Tue May 17, 2005 4:01 pm

Re: shorten a XPATH expression (or-junction)

Post by adrian » Wed Feb 14, 2018 5:33 pm

Hi,

Try:

Code: Select all

<xsd:assert test="G_SG8/G_SG10/S_CCI[D_7059='Z01']/(D_4051=('Z30', 'Z31'))" />
Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

mariomueller
Posts: 30
Joined: Wed Feb 14, 2018 3:27 pm

Re: shorten a XPATH expression (or-junction)

Post by mariomueller » Thu Feb 15, 2018 6:32 am

Hi Adrian,

thanks for your reply. Unfortunatelly this does not work :-(

Regards
Mario

mariomueller
Posts: 30
Joined: Wed Feb 14, 2018 3:27 pm

Re: shorten a XPATH expression (or-junction)

Post by mariomueller » Thu Feb 15, 2018 6:44 am

Hi adrian,

I found it. This works:

<xsd:assert test="G_SG8/G_SG10/S_CCI[D_7059='Z01']/D_4051=('Z30','Z31')"/>

Regards
Mario

Post Reply