Results 1 to 6 of 6

Thread: Can I "UnTransform" HTML back to XML?

  1. #1

    Thread Starter
    Super Moderator FunkyDexter's Avatar
    Join Date
    Apr 2005
    Location
    An obscure body in the SK system. The inhabitants call it Earth
    Posts
    7,900

    Can I "UnTransform" HTML back to XML?

    The scenario's this. I've got an entity in the form of an xml document. I use an xslt tranformation to turn it into an html page with apropriate editing controls for each editable property of the entity. The user can then edit those properties as they see fit and click save. I want to somehow get the ammended entity back as xml.

    At the moment I'm storing the xpath of each property in the attributes collection of the control. This allows me to build a new xml document according to the xsd, searching out the individual controls that were created from each element and take the updated value from the control. It works but it's messy and I can't help thinking I'm missing something. It feels like I should be able to just somehow take the html and "untransform" it using the xslt that I originally used to transform it to get the xml back. Does such a function exist?

    Anyone who could point me in the right direction will recieve my undying gratitude and a buscuit.
    The best argument against democracy is a five minute conversation with the average voter - Winston Churchill

    Hadoop actually sounds more like the way they greet each other in Yorkshire - Inferrd

  2. #2
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,532

    Re: Can I "UnTransform" HTML back to XML?

    Untransform? No... but what you can do is transform it again, using another xslt that "undoes" what the original xslt did. That's about as close to an untransform as you're going to get.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3

    Thread Starter
    Super Moderator FunkyDexter's Avatar
    Join Date
    Apr 2005
    Location
    An obscure body in the SK system. The inhabitants call it Earth
    Posts
    7,900

    Re: Can I "UnTransform" HTML back to XML?

    I did think of that originally but couldn't really visualise what that xslt would look like. I abandoned the idea and when on to the mechanical aproach I'm currently using. Now that you suggested it you got me thinking and, actually, it shouldn't be that hard. I think (though I'd have to double check) that I've been disciplined enough about the html it produces so that it constitutes an valid xml document. So I should be able to write a transofrm to go back the other way using xpath queries etc. If I get out of thinking I'm transforming xml into html on the first pass and view it as transforming xml to xml (which also just happens to be html) then the reverse should be do-able.

    Hmm. Time to give that another punt I think. Thanks TG.
    The best argument against democracy is a five minute conversation with the average voter - Winston Churchill

    Hadoop actually sounds more like the way they greet each other in Yorkshire - Inferrd

  4. #4
    Junior Member
    Join Date
    Feb 2014
    Location
    Sydney, Australia
    Posts
    23

    Re: Can I "UnTransform" HTML back to XML?

    Any chance you can post an example XML and the same as HTML? I realize your post is about two weeks old now, however if you haven't solved it yet let me know.

  5. #5

    Thread Starter
    Super Moderator FunkyDexter's Avatar
    Join Date
    Apr 2005
    Location
    An obscure body in the SK system. The inhabitants call it Earth
    Posts
    7,900

    Re: Can I "UnTransform" HTML back to XML?

    I must admit I haven't touched it in the last two weeks so it hasn't moved on. I've got a rather trivial prototype that takes an xml and transforms it to html I could post. I'll try to remember to do that when I get home this evening. I'll warn you , though, it's VERY trivial and was only meant to be a proof of concept.
    The best argument against democracy is a five minute conversation with the average voter - Winston Churchill

    Hadoop actually sounds more like the way they greet each other in Yorkshire - Inferrd

  6. #6
    Junior Member
    Join Date
    Feb 2014
    Location
    Sydney, Australia
    Posts
    23

    Re: Can I "UnTransform" HTML back to XML?

    Quote Originally Posted by FunkyDexter View Post
    I must admit I haven't touched it in the last two weeks so it hasn't moved on. I've got a rather trivial prototype that takes an xml and transforms it to html I could post. I'll try to remember to do that when I get home this evening. I'll warn you , though, it's VERY trivial and was only meant to be a proof of concept.
    I often have weird ideas, decide to build something just to see if I can, then once I have, delete the entire project.
    Bring it on!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width