Page 1 of 1

find out the nodes

Posted: Wed Sep 21, 2022 2:23 pm
by shilpa
Hi Team,
I want to find out the nodes which are online with text as Image Online
I am using the code "//embedded.figure.reference[@rendition-type='online']" with this am getting both the online and Inline nodes..
But i need to find out the nodes which are Image Online.
Please help on this.
<embedded.figure.reference image-key="RPT.CC.0.00030" rendition-type="online">Image Online</embedded.figure.reference>
<embedded.figure.reference image-key="RPT.CC.0.00030" rendition-type="online">Image Inline</embedded.figure.reference>

Thanks & Regards
Shilpa.P

Re: find out the nodes

Posted: Wed Sep 21, 2022 2:50 pm
by Bogdan Dumitru
Hello,

To match the elements that have the "rendition-type" attribute with the "online" value and that contains the "Image Outline" text, use this XPath selector:

Code: Select all

//embedded.figure.reference[@rendition-type='online'][text()='Image Online']

Re: find out the nodes

Posted: Wed Sep 21, 2022 4:16 pm
by shilpa
Hi Bogdan Dumitru,

I added //embedded.figure.reference[@rendition-type='online'][text()='Image Online'] and its giving 0 nodes.
Please do the needful

Thanks & Regards
Shilpa.P

Re: find out the nodes

Posted: Thu Sep 22, 2022 9:49 am
by Bogdan Dumitru
Hello Shilpa,

The given XPath worked for me, here's what I've done to test it:
  • opened Oxygen XML Editor (I've figured it out that you're using the stand-alone application because this topic was written into the Oxygen XML Editor forum's section)
  • created a new XML file based on your fragment:
  • opened XPath/XQuery Builder view
  • pressed the "Execute XPath" button
Please help us to better understand your problem by clarifying the following questions:
  • how do you invoke the XPath?
  • do you use Oxygen XML Editor or Oxygen XML Web Author?
  • do I understand correctly your needs: match the elements that have the "rendition-type" attribute with the "online" value and that contain the "Image Outline" text?
Please see this Gif:
Image

Re: find out the nodes

Posted: Thu Sep 22, 2022 11:04 am
by shilpa
Hi Bogdan Dumitru,
Below are the answers for your questions

how do you invoke the XPath? Using DocumentControllerl.findNodesByXPath();
do you use Oxygen XML Editor or Oxygen XML Web Author? Oxygen XML Web Author
do I understand correctly your needs: match the elements that have the "rendition-type" attribute with the "online" value and that contain the "Image Outline" text? Yes "rendition-type" attribute with the "online" value is correct where as "Image Online" is not text its placeholder.

I would like to know how to fetch for placeholder?
I have one more question say , figure node is there in both para and paratext but i want to fetch only from para not from paratext.
How to write a xpath to fetch embedded.figure.reference nodes from otherplaces not in paratext.
<para>
<figure> <embedded.figure.reference image-key="RPT.CC.0.00030" rendition-type="online">Image Online</embedded.figure.reference></figure>
<paratext>
<figure><embedded.figure.reference image-key="RPT.CC.0.00030" rendition-type="online">Image Online</embedded.figure.reference></figure>
</paratext>
</para>

Thanks & Regards
Shilap.p

Re: find out the nodes

Posted: Fri Sep 23, 2022 8:17 am
by Bogdan Dumitru
Hi Shilpa,

Regarding "I would like to know how to fetch for placeholder", I'm not sure what you mean by "placeholder". Usually a placeholder it's a text that it's present when the element is empty, in Oxygen it can be configured via the "-oxy-placeholder-content" CSS property [0], it's only a hint for the author, it's not part of the XML source as you can see from "Edit as XML" action from the "More..." menu.
Do you refer to the "-oxy-placeholder-content" placeholder or at the text node within the element?

Regarding "How to write a xpath to fetch embedded.figure.reference nodes from otherplaces not in paratext", this can be done by using the "ancestor::" XPath Axis, for example "//c[not(ancestor::a)]" would select all "c" elements that doesn't have "a" as an ancestor.

[0] https://www.oxygenxml.com/doc/versions/ ... nsion.html