|
|
 |
| 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.
|
 |

February 27th, 2007, 02:07 PM
|
|
Authorized User
|
|
Join Date: Feb 2007
Location: , , .
Posts: 41
Thanks: 2
Thanked 0 Times in 0 Posts
|
|
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:
<a href="http://www.state.gov/ofm/">More about OFM</a>
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.
|

February 27th, 2007, 03:04 PM
|
 |
Wrox Author
Points: 12,735, Level: 48 |
|
|
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 3,923
Thanks: 0
Thanked 82 Times in 80 Posts
|
|
Parsing converts < to < and converts < to a node. Conversely, serialization converts nodes to < and converts < to < So if you want your transformation to start with < 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
|

February 27th, 2007, 03:42 PM
|
|
Authorized User
|
|
Join Date: Feb 2007
Location: , , .
Posts: 41
Thanks: 2
Thanked 0 Times in 0 Posts
|
|
Michael, thanks so much as usual. DOE is ok for my purposes, frowned upon or not. Works like a charm. Thanks again
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |