Re: [xsl] What is the correct xpath?

Subject: Re: [xsl] What is the correct xpath?
From: "dvint dvint@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 2 May 2025 17:03:47 -0000
Yeah, sorry, I had cleaned the namespace out of all but that last example to
make it simpler. I couldn't figure out the correct way to match the content in
the xpath.I made a hack of getting to the correct context with a for-each and
will replace that with this. Someone else actually proposed this as well, I
just hadn't got back to implenting it.Thanks everyone...danSent from my
Verizon, Samsung Galaxy smartphone
-------- Original message --------B From: "ajbufort@xxxxxxxxxxxxxxxx
ajbufort@xxxxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date:
5/2/25  8:11 AM  (GMT-08:00) To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re:
[xsl] What is the correct xpath?


Not seeing anything regarding your need for the "j:" namespace.B  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: [xsl] What is the correct xpath?
B 


I have this XML

<test>
B B B  <string key="method">POST</string>
B B B  <array key="header">
B B B B B B B B  <map>
B B B B B B B B B B B B  <string key="key">Authorization</string>
B B B B B B B B B B B B  <string key="value">BasicB 
{{solutionAppID:solutionAppSecret}}</string>
B B B B B B B B  </map>
B B B B B B B B  <map>
B B B B B B B B B B B  <string key="key">Content-Type</string>
B B B B B B B B B B B  <string
key="value">application/x-www-form-urlencoded</string>
B B B B B B B B  </map>
B B B  </array>
B B  <map key="body">
B B B B B B  <string key="mode">urlencoded</string>
B B B  </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 findB  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









XSL-List info and archive

EasyUnsubscribe
(by email)

Current Thread