[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Tags in text content

Subject: Re: Tags in text content
From: "Pieter Masereeuw pieter@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 11 Apr 2024 14:01:37 -0000
Re:  Tags in text content
For people that like to use XProc, in situations like this, XProc's <p:unescape-markup content-type="text/html"/> is my friend.

It may generate some extra HTML elements that you don't want. I remove them with <p:unwrap match="html:html | html:head | html:body" xmlns:html="http://www.w3.org/1999/xhtml"/>

Pieter

On 4/11/24 10:34, Norm Tovey-Walsh ndw@xxxxxxxxxx wrote:
I have some xml where there are btagsb embedded in the text content.
As Martin suggested, parse-xml-fragment() will do the job as long as all of the escaped markup is well-formed. If whatbs been escaped is HTML that may have come from a process that produced not-well-formed markup, for example:

<root>
     <p>&lt;em&gt;End tags? We donbt need no stinking end tags![1]</p>
</root>

then the problem is a little harder. What Ibve found successful in this case is the Validator.nu HTML parser. It will parse any input and produce a well-formed document that conforms to the parsing rules of HTML5. Some post-processing may be necessary to tidy it back up again (removing the HTML5 namespace, removing the <html> wrapper, etc. but thatbs *much* easier once you have an XML fragment).

                                         Be seeing you,
                                           norm

[1] https://en.wikipedia.org/wiki/Stinking_badges

--
Norm Tovey-Walsh <ndw@xxxxxxxxxx>
https://norm.tovey-walsh.com/

There is a great difference between seeking how to raise a laugh from
everything, and seeking in everything what may justly be laughed
at.--Lord Shaftesbury

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.