|
Subject: [xsl] Xpath to node that has a parent with a certain attribute From: "Manuel Souto Pico terminolator@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Tue, 25 Oct 2016 16:02:11 -0000 |
Hi there,
I'm struggling to match a node where the parent has a particular id,
perhaps someone can help me.
This is my data:
<xliff>
<file>
<header/>
<body>
(...)
<trans-unit id="xxx>
<source xml:lang="en">foo</source>
<target xml:lang="sl" state="zzz">bar</target>
</trans-unit>
I have parsed the file and I am trying expressions
$xliff->xpath('//target[parent::trans-unit[@id="xxx"]]')
and
$xliff->xpath('//trans-unit[@id="xxx"]/target')
but they both give me the same result:
array(1) {
[0]=>
object(SimpleXMLElement)#8 (1) {
["@attributes"]=>
array(1) {
["state"]=>
string(22) "zzz"
}
}
}
My expected result is "bar"
What I doing wrong?
I'm doing this in php 5.5.11 with libxml Version 2.9.1.
Thank you so much.
Cheers, Manuel
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| [xsl] [ANN] XML Prague 2017 - Call , Jirka Kosek jirka@xx | Thread | Re: [xsl] Xpath to node that has a , Michael Kay mike@xxx |
| [xsl] [ANN] XML Prague 2017 - Call , Jirka Kosek jirka@xx | Date | Re: [xsl] Xpath to node that has a , Michael Kay mike@xxx |
| Month |