0

For a node

<a:cs id='x'>

If current node is id (the attribute), how to retrieve Element node; i.e; a:cs?

unknown_boundaries
  • 1,482
  • 3
  • 25
  • 47

1 Answers1

0

Simply with an XPath like parent::tagname. In your case that would accordingly be: parent::a:cs.

Be aware that this only works if a is properly declared as boinded taglib

Vogel612
  • 5,620
  • 5
  • 48
  • 73
potame
  • 7,597
  • 4
  • 26
  • 33
  • No, XPath can have just "cs" in it but not the "a:cs", what I require. – unknown_boundaries Mar 25 '15 at 09:51
  • SO you want to retrieve the parent of @id only if it is the `` tag? – potame Mar 25 '15 at 10:03
  • What ever the parent name is in entirety. I mean with colons in this case. Since it's storing element information in "a:cs" form in the object internally. I just don't see any API to retrieve that. – unknown_boundaries Mar 25 '15 at 10:07
  • With `parent::*` you will retrieve the parent of @id, whatever its name. If you want to get the name of this element, you can use `name(parent::*)`. – potame Mar 25 '15 at 10:24
  • Actually it is perfectly possible to use an XPath such as `parent::a:cs`, but the prefix `a`has to be declared and bounded the appropriate namespace url. – potame Mar 25 '15 at 10:26
  • In my case XPath is - /sld[1]/cSld[1]/spTree[1]/sp[1]/txBody[1]/p[1]/r[1]/rPr[1]/cs[1]. Notice cs rather than a:cs! – unknown_boundaries Mar 25 '15 at 14:07