executing XPath after XInclude
Oxygen general issues.
-
- Posts: 26
- Joined: Wed Jun 26, 2013 1:08 am
executing XPath after XInclude
Post by avanlooveren »
I have elements that I want to style in Author depending on contextual information. For this, I figured that I would use oxy_xpath() to perform a test that, importantly, grabs information (an attribute) from the parent element. This works until I XInclude the content. I checked the forum, and I see a few posts related to this issue:
- 1)xi:include is not included while evaluating XPath states "...XPaths are only performed on the current document's content."
2)oxy_xpath not evaluating for xi:include elements/attributes in parent document shows that attr(attrName) will get attribute even inside XIncludes, which I have confirmed.
Code: Select all
myChildElement {
border-color: oxy_xpath("if (@childId = ../@specialChildId) then 'yellow' else 'black'"));
}
-
- Posts: 1016
- Joined: Wed Nov 16, 2005 11:11 am
Re: executing XPath after XInclude
Post by alex_jitianu »
Hello,
The oxy_xpath function doesn't go into XInclude content so as you discovered you can't use it for elements from inside the XInclude.
First you should check the supported CSS selectors just in case you can express the condition just by selector alone. For example, assuming you already know the value of the attributes (which considering they are IDs I doubt that you do) you could write:
If the CSS selectors are not enough and you don't mind going into the Java based API, you can implement a ro.sync.ecss.extensions.api.StylesFilter. In this filter you can inspect the parent elements and check the attributes etc and if certain conditions met you can add new styles on the element. Here is a topic that describes how to implement such an extension point: http://www.oxygenxml.com/doc/ug-editor/ ... ilter.html.
Best regards,
Alex
The oxy_xpath function doesn't go into XInclude content so as you discovered you can't use it for elements from inside the XInclude.
First you should check the supported CSS selectors just in case you can express the condition just by selector alone. For example, assuming you already know the value of the attributes (which considering they are IDs I doubt that you do) you could write:
Code: Select all
*[specialChildId="my_value"] > myChildElement[childId="my_value"] {
border-color:yellow;
}
Best regards,
Alex
-
- Posts: 1016
- Joined: Wed Nov 16, 2005 11:11 am
Re: executing XPath after XInclude
Post by alex_jitianu »
Hi,
For future reference, starting with version 17.1, oxy_xpath() also expands XIncludes.
Best regards,
Alex
For future reference, starting with version 17.1, oxy_xpath() also expands XIncludes.
Best regards,
Alex
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