aspose file tools*
The moose likes XML and Related Technologies and the fly likes how to transform mixed xml+html file? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "how to transform mixed xml+html file? " Watch "how to transform mixed xml+html file? " New topic
Author

how to transform mixed xml+html file?

Holmes Wong
Ranch Hand

Joined: Feb 18, 2002
Posts: 163
Hi,
I am trying to transform a mixed xml+html file into xhtml, I can
create a xsl stylesheet to translate xml part, but I do
not know how to keep html code and its location.
The following is a sample file:
<?xml version="1.0" encoding="utf-8"?>
<sim xmlns='http://www.w3.org/TR/REC-html40'
xmlns:sample='http://www.sample.com/sam'>
<sample:form>
<b>Sample file</b>
<form:tag1/>
<form:tag2 values=�value1� defined=�value2�/>
<input type=�text� name=�student�/>
<input type=�submit/>
</sample:form>
</sim>
Thanks in advance for your input.
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
XSL can only be applied to well-formed XML documents. If you've got a mix of HTML and XML that is not well-formed, I'm afraid there's nothing you can do but fix it somehow before proceeding with the XSL transformation. If the HTML stuff is well-formed, there is no problem -- the parser considers it as XML just like the standard XHTML tags, right? Or did I miss something?


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Holmes Wong
Ranch Hand

Joined: Feb 18, 2002
Posts: 163
Thanks Lasse:
You reminded me of using xhtml as standard xml to be processed
by xsl file. I guess I need to make xml file well-formed first.
Originally posted by Lasse Koskela:
XSL can only be applied to well-formed XML documents. If you've got a mix of HTML and XML that is not well-formed, I'm afraid there's nothing you can do but fix it somehow before proceeding with the XSL transformation. If the HTML stuff is well-formed, there is no problem -- the parser considers it as XML just like the standard XHTML tags, right? Or did I miss something?
 
Consider Paul's rocket mass heater.
 
subject: how to transform mixed xml+html file?