Subject: Re: [xsl] What is the correct xpath? From: "ajbufort@xxxxxxxxxxxxxxxx ajbufort@xxxxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Fri, 2 May 2025 15:11:45 -0000 |
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: [xsl] 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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Convert JSON to XML?, Dave Pawson dave.paw | Thread | Re: [xsl] What is the correct xpath, dvint dvint@xxxxxxxx |
Re: [xsl] Convert JSON to XML?, Peter Flynn peter@xx | Date | Re: [xsl] Convert JSON to XML?, Tony Graham tgraham@ |
Month |