Subject: Re: < to < while preserving &
From: "Abel Braaksma (online)" <abel.online@xxxxxxxxx>
Date: Fri, 27 Jul 2007 12:13:33 +0200 (CEST)
|
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 < and > that is inside
a text using a template like this together with a copy idiom:
<xsl:template match="text()[matches(., '>|<']" >
<xsl:sequence select="translate(., '><', '&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="<([a-z]+)>(.*)</\1>"
which will capture the tagname in the $1 and the content between the
tags in $2.
Cheers,
-- Abel
> Hello,
>
> <title>Me & You <i>together</i></title>
>
> I tried my best with character-maps to get from the above
> XML the following HTML:
>
> <h3>Me & You <i>together</i></h3>
>
> Is this possible? And how could it be done?
>
> Gr|_e,
>
> Kai Weber
|