p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition ISBN: 978-0-470-19274-0 (http://p2p.wrox.com/forumdisplay.php?f=398)
-   -   html to xml convertion using xslt (http://p2p.wrox.com/showthread.php?t=71546)

moshaik November 20th, 2008 02:22 PM

html to xml convertion using xslt
I am new to this forums and new to the XSLT

Thanks for you support. Need help urgent.

we can translate xml to html using xsl, is it poseble to get reverse by using the same xsl? if so please tell me how ! or tell how easy way to get transelate html to xml.

input html file

<div id="csResponse">
<h2><a name="csResponse">cs Response</a></h2>
<p>Para acontent 1111</p>

<h3><a name="vs11">Vulnerability Characteristics</a></h3>
<p> para content22222 </p>
<pre> clicode content 111 </pre>

<h3><a name="vs22">Vulnerability Characteristics</a></h3>
<p> para content22222 </p>
<pre> clicode content 2222</pre>

<h3><a name="vs33">Vulnerability Characteristics</a></h3>
<p> para content333 </p>
<pre> clicode content 3333</pre>
<p> para content3333333 </p>


Out put XML file
<Concept Title="csResponse">
<Para>Para acontent 1111</Para>

<Concept Title="vs11">
<Para><p> para content22222 </p></Para>
<CLICode> clicode content 111</CLICode>

<Concept Title="vs22">
<Para>Para acontent 1111</Para>
<CLICode> clicode content 2222</CLICode>

<Concept Title="vs33">
<Para>para content333</Para>
<CLICode> clicode content 3333</CLICode>
<Para> para content3333333 </Para>


mhkay November 20th, 2008 07:16 PM

If the HTML is well-formed (i.e. XHTML) then you can use XSLT to transform it. But of course it will need completely different XSLT code. And don't expect that every transformation is fully reversible - after all, you can compute 2+2=4, but you can't reverse that to convert 4 to 2+2.

Michael Kay
Author, XSLT 2.0 and XPath 2.0 Programmer's Reference

moshaik November 24th, 2008 10:33 AM

Thanks for your input. I will try to write new XSL

All times are GMT -4. The time now is 05:17 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.