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

Re: &lt; to < while preserving &amp;

Subject: Re: &lt; to < while preserving &amp;
From: "Abel Braaksma (online)" <abel.online@xxxxxxxxx>
Date: Fri, 27 Jul 2007 12:13:33 +0200 (CEST)
Re:  &lt; to < while preserving &amp;
In addition to what's already been said, you may think of one of the
following two approaches of tackling this mess:

1. Using XSLT 2.0, you can replace any &lt; and &gt; that is inside
a text using a template like this together with a copy idiom:

<xsl:template match="text()[matches(., '&gt;|&lt;']" >
   <xsl:sequence select="translate(., '&gt;&lt;', '&EF00;&EF01')" />
</xsl:template>

and apply your character maps to the private use characters &EF00;
and &EF01; respectively.

2. Using a little bit more sophisticated replace and a function,
considering that only little tags (i.e., <b>, <i> <strong> etc) are
wrongly escaped that way, you can create your own saxon:parse
replacement with a regular expression + analyze-string (use both the
matching and non-matching part). I.e., you matching regex could be
something like this:

regex="&lt;([a-z]+)&gt;(.*)&lt;/\1&gt;"

which will capture the tagname in the $1 and the content between the
tags in $2.


Cheers,
-- Abel





> Hello,
>
> <title>Me &amp; You &lt;i&gt;together&lt;/i&gt;</title>
>
> I tried my best with character-maps to get from the above
> XML the following HTML:
>
> <h3>Me &amp; You <i>together</i></h3>
>
> Is this possible? And how could it be done?
>
> Gr|_e,
>
> Kai Weber

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

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

Buy Stylus Studio Now

Cast Your Vote

We need your help – Vote for DataDirect XML Products!

  • Best SOA or XML site

Winners and finalists announced at SOA World Conference in November.

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-2007 All Rights Reserved.