XML transformation #612

Closed
opened 2025-12-29 15:28:15 +01:00 by adam · 7 comments
Owner

Originally created by @rmeshksar on GitHub (Jun 18, 2024).

Originally assigned to: @StefH on GitHub.

Hi,
Consider this xml in the body of a request:

<People>
  <Person FirstName="John" LastName="Doe" />
  <Person FirstName="Jane" LastName="Doe" />
</People>

In response, how can I transform it to:

<All>
  <Employee FullName="John Doe"></Employee>
  <Employee FullName="Jane Doe"></Employee>
</All>

Basically I want to loop in nodes "//Person" and for each item use that node to generate response node using XPath selector on the request node.

I looked at the examples here but none of them worked in this case:
2c22f91293/test/Handlebars.Net.Helpers.Tests/Templates/XPathPathHelpersTemplateTests.cs

Thanks.

Originally created by @rmeshksar on GitHub (Jun 18, 2024). Originally assigned to: @StefH on GitHub. Hi, Consider this xml in the body of a request: ```xml <People> <Person FirstName="John" LastName="Doe" /> <Person FirstName="Jane" LastName="Doe" /> </People> ``` In response, how can I transform it to: ```xml <All> <Employee FullName="John Doe"></Employee> <Employee FullName="Jane Doe"></Employee> </All> ``` Basically I want to loop in nodes "//Person" and for each item use that node to generate response node using XPath selector on the request node. I looked at the examples here but none of them worked in this case: https://github.com/Handlebars-Net/Handlebars.Net.Helpers/blob/2c22f91293b2cbcb94c0c39906b0393fc7969b9c/test/Handlebars.Net.Helpers.Tests/Templates/XPathPathHelpersTemplateTests.cs Thanks.
adam added the feature label 2025-12-29 15:28:15 +01:00
adam closed this issue 2025-12-29 15:28:15 +01:00
Author
Owner

@StefH commented on GitHub (Jun 26, 2024):

It is possible, but I don't know the answer.

For this scenario, XSLT transformation would be a better choice. However, that's not yet implemented in Handlebars.Net

@StefH commented on GitHub (Jun 26, 2024): It is possible, but I don't know the answer. For this scenario, XSLT transformation would be a better choice. However, that's not yet implemented in Handlebars.Net
Author
Owner

@StefH commented on GitHub (Jun 27, 2024):

https://github.com/Handlebars-Net/Handlebars.Net.Helpers/pull/99

@StefH commented on GitHub (Jun 27, 2024): https://github.com/Handlebars-Net/Handlebars.Net.Helpers/pull/99
Author
Owner

@StefH commented on GitHub (Jun 28, 2024):

@rmeshksar
I've released a preview for WireMock.Net : 1.5.59-ci-18848 (https://github.com/WireMock-Net/WireMock.Net/wiki/MyGet-preview-versions) which can transform xml using xslt.

@StefH commented on GitHub (Jun 28, 2024): @rmeshksar I've released a preview for WireMock.Net : `1.5.59-ci-18848` (https://github.com/WireMock-Net/WireMock.Net/wiki/MyGet-preview-versions) which can transform xml using xslt.
Author
Owner

@StefH commented on GitHub (Jul 2, 2024):

@rmeshksar
Did you have time to review this?

@StefH commented on GitHub (Jul 2, 2024): @rmeshksar Did you have time to review this?
Author
Owner

@StefH commented on GitHub (Jul 3, 2024):

https://github.com/WireMock-Net/WireMock.Net/pull/1128

@StefH commented on GitHub (Jul 3, 2024): https://github.com/WireMock-Net/WireMock.Net/pull/1128
Author
Owner

@rmeshksar commented on GitHub (Jul 4, 2024):

Thanks so much and sorry that I did not notice this to respond in time,
I will try it.

@rmeshksar commented on GitHub (Jul 4, 2024): Thanks so much and sorry that I did not notice this to respond in time, I will try it.
Author
Owner

@StefH commented on GitHub (Jul 5, 2024):

It's not yet in master, but you can try preview 1.5.59-ci-18865

@StefH commented on GitHub (Jul 5, 2024): It's not yet in master, but you can try preview 1.5.59-ci-18865
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/WireMock.Net-wiremock#612