Not seeing anything regarding your need for the "j:" namespace. Might that be
interfering with your expectations somehow?
Popping your XML and XPath in oXygen works for me, provided I modify it
slightly for the context in which I am running it.
//array[@key='header']/map[string[@key='key'][. = 'Content-Type']]/string[@key
= 'value']
returns
application/x-www-form-urlencoded
-Tony
Anthony J. "Tony" Bufort
AJB Consulting
www.ajbconsulting.us
________________________________
From: dvint@xxxxxxxxx <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Wednesday, April 30, 2025 4:04 PM
To: xsl <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Subject: What is the correct xpath?
I have this XML
<test>
<string key="method">POST</string>
<array key="header">
<map>
<string key="key">Authorization</string>
<string key="value">Basic
{{solutionAppID:solutionAppSecret}}</string>
</map>
<map>
<string key="key">Content-Type</string>
<string
key="value">application/x-www-form-urlencoded</string>
</map>
</array>
<map key="body">
<string key="mode">urlencoded</string>
</map>
</test>
I'm processing the value in <string key="mode">urlencoded</string>. I
need to marry this with the <string key="value"> in the <map> with
<string key="key">Content-Type</string>.
I get to the right area with this
"../array[@key='header']/map/string[@key='key']" I'm stuck on how to now
match the value "Content-Type" and then find the content of <string
key="value">application/x-www-form-urlencoded</string>
So something like this which isn't working
../j:array[@key='header']/j:map/j:string[@key='key']['Content-type']/followin
g-sibling::j:string[@key='value']
This just returns Content-type, what am I doing wrong?
..dan
|