Insert Attribute with value automatically
Post here questions and problems related to oXygen frameworks/document types.
-
- Posts: 168
- Joined: Fri Jan 20, 2017 1:11 pm
Insert Attribute with value automatically
Hello,
We use the oxygen sdk in version 25.0.0.0.
We want to automate the insertion of an attribute with a default value each time an element is inserted.
To do that, we use the cc_common.xml
Here what we have tried :
Here is the xsd
The attribute eoTopicType is well added but the value is empty.
Did we miss something with elementProposals definition ?
Thanks,
Regards,
Isabelle
We use the oxygen sdk in version 25.0.0.0.
We want to automate the insertion of an attribute with a default value each time an element is inserted.
To do that, we use the cc_common.xml
Here what we have tried :
Code: Select all
<elementProposals path="eoTopic">
<insertAttribute name="eoTopicType" value="eott04"/>
</elementProposals>
Code: Select all
<xs:element name="eoTopic" type="eoTopicElemType"/>
<xs:complexType name="eoTopicElemType">
<xs:element ref="eoTopicContent"/>
<xs:attribute ref="eoTopicType" use="required"/>
<xs:attribute ref="id"/>
</xs:complexType>
<xs:attribute name="eoTopicType" type="eoTopicTypeAttType"/>
<xs:simpleType name="eoTopicTypeAttType">
<xs:restriction base="xs:string">
<xs:enumeration value="eott01"/>
<xs:enumeration value="eott02"/>
<xs:enumeration value="eott03"/>
<xs:enumeration value="eott04"/>
<xs:enumeration value="eott05"/>
<xs:enumeration value="eott06"/>
<xs:enumeration value="eott07"/>
<xs:enumeration value="eott08"/>
<xs:enumeration value="eott09"/>
<xs:enumeration value="eott10"/>
</xs:restriction>
</xs:simpleType>
Did we miss something with elementProposals definition ?
Thanks,
Regards,
Isabelle
-
- Posts: 1016
- Joined: Wed Nov 16, 2005 11:11 am
Re: Insert Attribute with value automatically
Post by alex_jitianu »
Hello,
I've created a sample project starting from your code snippets, but I didn't reproduce the issue.
You might also try the same scenario inside an Oxygen XML Editor/Author (I can provide a trial license if needed) to understand if the SDK performs differently, somehow.
Best regards,
Alex
How do you insert the element? Through the content completion window?We want to automate the insertion of an attribute with a default value each time an element is inserted.
I've created a sample project starting from your code snippets, but I didn't reproduce the issue.
cc_config.zip
Please load the *.xpr file inside the Project view and open sample.xml. Insert an "eoTopic" element inside the root element by using the content completion window. I the attribute value inserted? If it is, do you notice something different between my cc_config.xml/XSD and yours?You might also try the same scenario inside an Oxygen XML Editor/Author (I can provide a trial license if needed) to understand if the SDK performs differently, somehow.
Best regards,
Alex
You do not have the required permissions to view the files attached to this post.
-
- Posts: 168
- Joined: Fri Jan 20, 2017 1:11 pm
Re: Insert Attribute with value automatically
Hi,
I have fixed issue on our side.
Now I have questions about this functionality.
Does it activate when you change an attribute ?
I have this condition :
But when I change the value of quantityType attribute, no quantityGroup is inserted.
Is it normal ?
Concerning match item, is it possible to conditionate it ?
For exemple, can I write this
Thanks,
Regards,
Isabelle
I have fixed issue on our side.
Now I have questions about this functionality.
Does it activate when you change an attribute ?
I have this condition :
Code: Select all
<elementProposals insertElements="quantityGroup" path="quantity[@quantityType='qty04']"/>
Is it normal ?
Concerning match item, is it possible to conditionate it ?
For exemple, can I write this
Code: Select all
<match elementName="quantity[@quantityType='qty04']" attributeName="quantityTypeSpecifics">
<items action="replace">
<item value="d"/>
<item value="m"/>
<item value="y"/>
</items>
</match>
Regards,
Isabelle
-
- Posts: 1016
- Joined: Wed Nov 16, 2005 11:11 am
Re: Insert Attribute with value automatically
Post by alex_jitianu »
Hello,
Best regards,
Alex
Yes. This is a configuration for content completion so it triggers only for items inserted through content completion. We can look at it as a limitation. We have API which can be used to achieve this use case (this is probably what you did, anyway).But when I change the value of quantityType attribute, no quantityGroup is inserted.
Is it normal ?
In version 24 we've added an alternate element which supports simplified XPath expressionsConcerning match item, is it possible to conditionate it ?
Code: Select all
<valueProposals path="para[@attr = "value"]"></valueProposals>
Alex
-
- Posts: 1016
- Joined: Wed Nov 16, 2005 11:11 am
Re: Insert Attribute with value automatically
Post by alex_jitianu »
Hi,
Yes, an AuthorDocumentFilter can be used to intercept such events, as attribute change (AuthorDocumentFilter.setAttribute(AuthorDocumentFilterBypass, String, AttrValue, AuthorElement))
Alex
Yes, an AuthorDocumentFilter can be used to intercept such events, as attribute change (AuthorDocumentFilter.setAttribute(AuthorDocumentFilterBypass, String, AttrValue, AuthorElement))
Alex
Return to “SDK-API, Frameworks - Document Types”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service