Need validation or workaround of selected content in XPath Activation
Posted: Wed Sep 06, 2023 5:41 pm
Dear masterminds,
I have the following problem, I would like to prevent that the ToggleSurroundWithElement operation creates empty elements when there is no text in the current element and no text | text() node is selected. In the schema, via restrictions in the XSD, elements with no content are also already set as errors. schemaAware is set as true.
1. There is no oxy:current-selected-content() (like here suggested) and oxy:selected-elements() as well as oxy:current-selected-element() access only the direct parent, because element(). But I need a way to interpret the selected text() node. But maybe I did not understand that oxy:selected-elements() maybe works different, but the example doesn't help.
2. Here is the a shorted XSD schema for the necessary element. Maybe there is the error here, so that's why the schemaAware principle doesn't work.
4. I tried something like ./string() ne '', but then the activation reports back that the operation is not valid. Is it possible that I can act in the XPath activations not on content but only on the element level.
5. Is there any other way than 1. and 2. to control the operation via XPath activation. But I would not like to write XQuery statement with external paramter oxy:selection for all actions. Which is an absolute fallback solution.
Thank you very much.
Best Regards
Lars
I have the following problem, I would like to prevent that the ToggleSurroundWithElement operation creates empty elements when there is no text in the current element and no text | text() node is selected. In the schema, via restrictions in the XSD, elements with no content are also already set as errors. schemaAware is set as true.
1. There is no oxy:current-selected-content() (like here suggested) and oxy:selected-elements() as well as oxy:current-selected-element() access only the direct parent, because element(). But I need a way to interpret the selected text() node. But maybe I did not understand that oxy:selected-elements() maybe works different, but the example doesn't help.
2. Here is the a shorted XSD schema for the necessary element. Maybe there is the error here, so that's why the schemaAware principle doesn't work.
Code: Select all
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
vc:minVersion="1.1" xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning">
<xs:element name="root">
<xs:complexType>
<xs:sequence>
<xs:element name="hi" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="NonEmptyString">
<xs:attribute name="rend" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="italic"/>
<xs:enumeration value="bold"/>
<xs:enumeration value="underline"/>
<xs:enumeration value="superscript"/>
<xs:enumeration value="subscript"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:simpleType name="NonEmptyString">
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
<xs:pattern value="[^\s]?"/>
<xs:pattern value="[^\s].*[^\s]"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>
5. Is there any other way than 1. and 2. to control the operation via XPath activation. But I would not like to write XQuery statement with external paramter oxy:selection for all actions. Which is an absolute fallback solution.
Thank you very much.
Best Regards
Lars