p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Go Back   p2p.wrox.com Forums > XML > XSLT
I forgot my password Register Now
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.

Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 27th, 2007, 02:07 PM
Authorized User
Points: 180, Level: 3
Points: 180, Level: 3 Points: 180, Level: 3 Points: 180, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2007
Location: , , .
Posts: 41
Thanks: 2
Thanked 0 Times in 0 Posts
Default XML Transformation - General HTML Issue

Hello,
I am working from XML documents that where html syntax is captured as escape sequences rather than as actual tags. For instance, rather than the html content characterized as:

<a href="http://www.state.gov/ofm/">More about OFM</a>

I get the corresponding escape sequences before and after the href as follows:

&lt;a href="http://www.state.gov/ofm/"&gt;More about OFM&lt;/a&gt;

What do I need to do to pre-process these strings such that all html syntax is properly output (as html tags)? Thanks so much for any assitance.


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old February 27th, 2007, 03:04 PM
mhkay's Avatar
Wrox Author
Points: 12,735, Level: 48
Points: 12,735, Level: 48 Points: 12,735, Level: 48 Points: 12,735, Level: 48
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 3,923
Thanks: 0
Thanked 82 Times in 80 Posts
Default

Parsing converts &lt; to < and converts < to a node. Conversely, serialization converts nodes to < and converts < to &lt; So if you want your transformation to start with &lt; and end up with <, then you either need to parse it twice and serialize it once, or to parse it once and suppress serialization. The first solution involves extracting the HTML as a string and (re-)parsing it to convert it into nodes, using some kind of extension function (e.g. saxon:parse in Saxon). The second solution involves using disable-output-escaping. d-o-e is usually frowned upon for two reasons: it's often misused, and it's not supported in all environments (for example it doesn't work in Firefox - in fact, it doesn't work in any environment where the result tree isn't serialized). But in this case, other than redesigning the source documents, it may be the best option.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #3 (permalink)  
Old February 27th, 2007, 03:42 PM
Authorized User
Points: 180, Level: 3
Points: 180, Level: 3 Points: 180, Level: 3 Points: 180, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2007
Location: , , .
Posts: 41
Thanks: 2
Thanked 0 Times in 0 Posts
Default

Michael, thanks so much as usual. DOE is ok for my purposes, frowned upon or not. Works like a charm. Thanks again

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
CALS to HTML Transformation RussellKay XSLT 1 May 11th, 2009 07:46 AM
search value of XML element/node in general deean XML 1 June 14th, 2008 04:17 AM
Is XML supports transformation of HTML to XML? zeeonline XSLT 1 July 28th, 2006 06:13 PM
XML to literal HTML Issue kwilliams XSLT 3 October 4th, 2005 09:35 AM
Xml to Xml Transformation using xslt ShaileshShinde XSLT 1 July 20th, 2005 02:20 AM



All times are GMT -4. The time now is 03:34 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc