re: Disable output escaping

Thanks much,

I did the following reading through M Kay's book which again works in oxygen
but not currently in calabash. I suppose I may have something else to do in
xproc to get it to work? Currently just using a p:store.

Anyone else do something like this in an xslt file and have it work in
xproc?

<!DOCTYPE xsl:stylesheet [
<!ENTITY ampersand "&#xE003;">
<!ENTITY less-than "&#xE001;">
<!ENTITY greater-than "&#xE002;">
]>
...

  <xsl:output method="html" indent="no" use-character-maps="entities"/>
  <xsl:character-map name="entities">
    <xsl:output-character character="&less-than;" string="&lt;"/>
    <xsl:output-character character="&greater-than;" string="&gt;"/>
    <xsl:output-character character="&ampersand;" string="&amp;"/>
  </xsl:character-map>

The xslt code that is relevant is something like the following which is
converting text that represents any html entity back into html entities for
the html output. Perhaps a better way to do this?

  <xsl:template name="normalizeEntityForHTML">
    <xsl:param name="arg" as="xs:string?"/>
    <xsl:variable name="ampersand">
      <xsl:text >&ampersand;</xsl:text>
    </xsl:variable>
    <xsl:value-of

select="replace(replace(replace(replace(replace(replace($arg,'§S§',concat($ampersand,'nbsp;')),'§L§','
'),'§(\d+)§',concat($ampersand,'#$1;')),'§([a-z]{1,8})§',concat($ampersand,'$1;')),'§!--.*?--§',''),'§BR§','&less-than;br/&greater-than;')"/>
  </xsl:template>

Regards
Alex



On Wed, May 19, 2010 at 3:17 PM, Wendell Piez <wapiez@mulberrytech.com>wrote:

> Hi again,
>
> Sorry Alex if that didn't give you any actionable advice.
>
> I'd suggest the following, in order of descending preference:
>
> 1. Examine your requirement and determine if you really need to do this.
>
> 2. Determine whether your XProc processor might have some kind of support
> (over and above the standard) for @use-character-map or the equivalent, or
> another way to configure serialization to a non-standard format.
>
> 3. Consider post-processing your results -- which seems really sad
> (post-processing the output of a pipeline?).
>
> Cheers,
> Wendell
>
> At 10:51 AM 5/19/2010, I wrote:
>
>> disable-output-escaping in XSLT is generally considered to be brittle ...
>>
>
>
>
>
> ======================================================================
> Wendell Piez                            mailto:wapiez@mulberrytech.com
> Mulberry Technologies, Inc.                http://www.mulberrytech.com
> 17 West Jefferson Street                    Direct Phone: 301/315-9635
> Suite 207                                          Phone: 301/315-9631
> Rockville, MD  20850                                 Fax: 301/315-8285
> ----------------------------------------------------------------------
>  Mulberry Technologies: A Consultancy Specializing in SGML and XML
> ======================================================================
>
>
>


-- 
Alex

An informal recording with one mic under a tree leads to some pretty sweet
acoustic sounds.
https://sites.google.com/site/greigconteh/albums/diabarte-and-sons



-- 
Alex

An informal recording with one mic under a tree leads to some pretty sweet
acoustic sounds.
https://sites.google.com/site/greigconteh/albums/diabarte-and-sons

Received on Thursday, 20 May 2010 08:16:39 UTC