Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition ISBN: 978-0-470-19274-0
This is the forum to discuss the Wrox book XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition by Michael Kay; ISBN: 9780470192740
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition ISBN: 978-0-470-19274-0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old November 20th, 2008, 02:22 PM
Registered User
 
Join Date: Nov 2008
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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
===============

<html>
<body>
<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>

</div>
</body>
</html>

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

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

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

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

</Topic>

  #2 (permalink)  
Old November 20th, 2008, 07:16 PM
mhkay's Avatar
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

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
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer's Reference
  #3 (permalink)  
Old November 24th, 2008, 10:33 AM
Registered User
 
Join Date: Nov 2008
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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



Similar Threads
Thread Thread Starter Forum Replies Last Post
XSLT convertion help mwells XSLT 3 February 2nd, 2007 10:00 AM
XSLT help : Interpretting HTML tags from XML kunal_kishan XSLT 1 June 26th, 2006 05:37 AM
Two HTML Tables and Two XSLT with Two XML? gman44 XSLT 1 March 1st, 2006 04:53 AM
constructing a HTML table from xml data using xslt rameshnarayan XSLT 0 September 19th, 2005 06:53 AM
Add XSLT transformed XML (html) on an aspx page humour XSLT 2 September 30th, 2004 05:13 AM





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