XML -> XSL -> HTML edit file, and SAVE changes in xml WITHOUT asp - html

I have an XML file that I've transformed with xsl and loaded into a browser as html. That html is editable using a rich text editor by the user. When they're done I need to transform their html edits back to the original xml document.
One solution I've found is using ASP: http://www.w3schools.com/xsl/xsl_editxml.asp
But I'm using Apache and I don't have ASP installed, and I'm wondering if there is an easier/better way to do this without using ASP.
Or is ASP the only way?
Thanks =)

The solutiton that you found doesn't do what you describe. It only presents the data from the XML as a form, and lets the user edit the values. That's not very complex, and you can do that using pretty much any other server side language, like PHP for example.
What you describe, on the other hand, is quite complex. It involves examining the XSL and the HTML to identify the parts of the HTML code that was created using specific XML data, so that changes can be reflected back. That's not something that is done with a simple ASP script like that.

If you design an XSL transformation for both directions, XML to HTML and HTML to XML, comparing the source XML and resulting user XML should be a much easier problem to solve.

Related

Automate Web Applications -parsing HTML Data

I just want to automate a web application, where that application parses the HTML page and pulls all the HTML Tags inner text based on some condition like if we have a tag called Span Example has given whose class="spanclass_1"
This is span tag...
which has particular class id. so that app parses and pulls that span into it.
And here the main pain area is, I should not use the developer code to automate that same parsing the HTML.
I want to automate that parsing done correctly, simply by using the parsed data which is shown in UI.
Any help, would be great.
Appreciating your time reading this.
(Note span tag is not shown)
Thanks buddies.
not enough details.
is this html page just a file in local filesystem on it is internet webpage?
do u have access to pages? can u modify it ? if answer yes, that just add javascript to page which will extract data and post to server.
if answer not, than it depends on language u use to programm.
Find good framework to parse html. load page parse it and extract data. Several situation can be there.
Worse scenario - page generated on client side using js.
Best scenario - page is in xhtml mode( u are lucky. any xml parser will help to build dom and extract data)
So so - page is simple html format (try several html parser to find most suitable for u)

make xml file using xslt and html

I have HTML page that I created using xslt and an xml file. now In this html file, there is the option to change some values, so after these changes I want to generate xml content with these changes. How can I do that? Is there an easy way?
It seems you are looking for somethig like XMLForm :- http://www.datamech.com/XMLForm/

Is it possible to make a selectable drop down menu using data from an XML file?

I'm trying to create a directory for an address book, and I was wondering if it would be possible to create a selectable drop down menu that would pull the contact data from an XML file. The ideal way I would want it is to have all of the names of the contacts in the drop down menu, and when one is selected the rest of the information would pop up above the drop down, such as Address, Phone Number, and Email.
Either use a server-side language such as PHP to extract the data from the XML and insert it into the HTML document, or use AJAX to pull the XML file to the client then use JavaScript to process it and insert it into the DOM.
There should be libraries/frameworks/plugins/whatever available to parse XML using whatever language you need, if you know how to insert stuff into the HTML document (in the case of PHP) or into the DOM (in the case of JavaScript), you can do this easy.
From what I understand you have an XML document. Using XSLT you create an XHTML file from your XML and that you can display in your browser (XHTML is HTML that is conform to XML rules).
If that is the case then, yes, you can make links using XSLT. But the data needs to be in your XML source file and not in some database.
There is an article that describes it: http://www.ibm.com/developerworks/xml/library/x-tipxslt/index.html
You could attach an XSL to the XML using something like this:
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="cdcatalog.xsl"?>
... actual XML content...
If applying the XSL on the XML outputs an HTML page with JavaScript, you can get the actual result.
Outputting JavaScript is a bit of a pain because of character escaping but it can be done.

Generate a xml from a html

Im trying to generate a xml from a html (url). The html website have a formulary that i want to get into a xml archive, but its too long and im searching a way to do it easier.
There is a method to generate a xml with all the fields, etc, from a html?
you can also use an html parser and print out the objects / array as xml
try this: http://sourceforge.net/projects/html2xml/
You can try the free dotnet-classlibrary SgmlReader that can load html into a xmldocument. This in turn can be saved as xml.

How do I send an XSL formatted XML file as the message of a JavaMail e-mail

I am using JavaMail to send an e-mail. My goal is to send the contents of an xml file formatted by an xsl file as the message of the e-mail. Is this possible?
I know that the following code can be used to send a string containing html.
message.set.Content(htmlString, "text/html");
Am I correct in my assumption that the formatting information to create a html message in an e-mail must be embedded in the html and that there is no way to connect to a css?
If this is so, then the same must apply to xml and xsl.
If there is a way to join an existing xml file and an existing xsl file in the body of a JavaMail e-mail, I would be very grateful to anyone who can give me the code that makes this possible.
If it is impossible, I will be happy to be informed of this and pointed in the right direction. I suspect that I will need to parse the xml file and convert it to a string containing html formatting.
Thank you.
It's true that most email clients will not process CSS. Here's a chart.
As a result, it's commonplace to apply formatting by transforming the CSS-formatted HTML to an inline-style that most email clients can handle. Sometimes this is done by preprocessing the document with XSLT.
If you want to take this route, I suggest you look at the Saxon XSLT processor to preprocess your XML document.
Another option to handle this problem would be something like Emogrifier, Premailer, or even this SO Question. Which processes a CSS and HTML into one inline-styled email-safe document.