oxy_xpath not evaluating for xi:include elements/attributes in parent document
Oxygen general issues.
-
- Posts: 2
- Joined: Wed Jan 02, 2013 11:58 pm
oxy_xpath not evaluating for xi:include elements/attributes in parent document
Post by sladeshelton »
I am trying to use the oxy_xpath CSS function to grab an attribute and set it as the content for my projects CSS file. It works fine in the xml document where the element and attribute are, but does not work as expected in the parent xml document where I use xi:include to reference the xml instance. From my research (Link to previous forum post), this seems to be a known issue. I wasn't sure if there was another work around for getting the oxy_xpath function to grab the referenced attribute.
-
- Posts: 9436
- Joined: Fri Jul 09, 2004 5:18 pm
Re: oxy_xpath not evaluating for xi:include elements/attributes in parent document
Hi,
The oxy_xpath works over a DOM source which has the xi:include references not expanded (and thus not transparent).
You could try to parse the @href's yourself in the oxy_xpath, something like:
Regards,
Radu
The oxy_xpath works over a DOM source which has the xi:include references not expanded (and thus not transparent).
You could try to parse the @href's yourself in the oxy_xpath, something like:
Code: Select all
article:before{
content:oxy_xpath('//xi:include/doc(@href)//@id | //@id');
}
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 2
- Joined: Wed Jan 02, 2013 11:58 pm
Re: oxy_xpath not evaluating for xi:include elements/attributes in parent document
Post by sladeshelton »
Thank you for the feedback and insight.
I found another option to grab the attribute values that seems to do the trick. Instead of the oxy_xpath function, I noticed the oxy_attributes() function returned the values I needed (along with the attribute name). This got me thinking and I tried the attr() function with the applicable attribute name and it works as expected.
The hurdle I encountered with the xpath example was it returned all @id's in my document, when I just wanted the @id value for each applicable element as the CSS was being applied to my document. I probably did not provide enough details in my initial post. My xml looks like this
root document:
deferrals1.xml:
deferrals2.xml:
The oxy_xpath was giving me both @id values at each deferral element with I was setting the content of the deferral element via CSS. Now I'm setting the content of the deferral element to attr(id) in the CSS and the value I need is being grabbed.
Thanks again for the explanation and feedback.
I found another option to grab the attribute values that seems to do the trick. Instead of the oxy_xpath function, I noticed the oxy_attributes() function returned the values I needed (along with the attribute name). This got me thinking and I tried the attr() function with the applicable attribute name and it works as expected.
The hurdle I encountered with the xpath example was it returned all @id's in my document, when I just wanted the @id value for each applicable element as the CSS was being applied to my document. I probably did not provide enough details in my initial post. My xml looks like this
root document:
Code: Select all
<fleets>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="deferrals1.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="deferrals2.xml"/>
</fleets>
Code: Select all
<fleet>
<deferrals>
<deferral id="value1"/>
</deferrals>
</fleet>
Code: Select all
<fleet>
<deferrals>
<deferral id="value2"/>
</deferrals>
</fleet>
Thanks again for the explanation and feedback.
-
- Posts: 9436
- Joined: Fri Jul 09, 2004 5:18 pm
Re: oxy_xpath not evaluating for xi:include elements/attributes in parent document
Hi,
I thought exactly the opposite, that you wanted to gather all IDs from all referenced modules.
Yes, using the attr() function is enough (and the usual way) to give you the value of an attribute defined on that element which is matched by the CSS selector:
http://www.oxygenxml.com/doc/ug-oxygen/ ... ction.html
Regards,
Radu
I thought exactly the opposite, that you wanted to gather all IDs from all referenced modules.
Yes, using the attr() function is enough (and the usual way) to give you the value of an attribute defined on that element which is matched by the CSS selector:
http://www.oxygenxml.com/doc/ug-oxygen/ ... ction.html
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
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