mausch / XmlLiteralsTypeProvider

F# type provider implementing compile-time XML literals
Apache License 2.0
5 stars 2 forks source link

Support XQuery style transformations #11

Open panesofglass opened 10 years ago

panesofglass commented 10 years ago

With this type provider, would I ne able to perform transforms from one schema to another?

mausch commented 10 years ago

Could you give me an example or use case? Is what you have in mind expressible in VB.NET ? If you mean to transform the XML after rendering, then yes, it's perfectly possible since it's a regular XElement. If you mean to transform the XML template before rendering, then no because in the general case that could alter the holes detected at compile-time.

panesofglass commented 10 years ago

I meant transform the XML after rendering, I think. I need to look at what you are actually building to be sure it even makes sense. I was primarily thinking of leveraging XML literals within F# query expressions that look a lot like FLWOR expressions. I can't find a good example that shows the use of XML literals within the result mapping.

mausch commented 10 years ago

Yeah, that's the beauty of having things in a proper node tree, you can transform it however you want. One example would be rendering proper HTML from the XML tree by transforming empty elements as needed. The cost of course is having the entire tree in memory (XStreamingElement might help with this however).