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

RE: Preseving character entities

Subject: RE: Preseving character entities
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 25 Nov 2004 13:39:17 -0000
xsl character map
Perhaps you forgot to do use-character-maps in your xsl:output declaration?

But why do you need the character map? Just specify:

<xsl:output encoding="us-ascii"/>

Michael Kay
http://www.saxonica.com/ 

> -----Original Message-----
> From: Richard Lewis [mailto:richardlewis@xxxxxxxxxxxxxx] 
> Sent: 25 November 2004 13:11
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Preseving character entities
> 
> Hello List,
> 
> I'm just trying to create some temporary XSL to convert my website
> content from one *BIG* XML document to a directory structure populated
> with lots of little documents. I've written two XSLT 2 
> stylesheets which
> first generate a shell script to create a directory structure based on
> the structural hierachy of the original document and next (using the
> xsl:result-document element) divide the original XML up into files in
> the new filesystem hierachy. Great.
> 
> The problem is that, when the XSLT parser (Saxon 8) parses 
> the document,
> it resolves all the character entities (like people with foreign
> characters in their names) to the actual characters. What I 
> really want
> is to have the character entities from the original document 
> left intact
> in the new documents.
> 
> I've written a little Python script which generates a big
> xsl:character-map with all the UTF characters above #130 mapped to
> literal character entities:
> 
> #!/usr/bin/python
> print "<?xml version=\"1.0\" ?>"
> print "<xsl:stylesheet
> xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" version=\"1.0\">"
> print "<xsl:character-map name=\"preserve-entities\">"
> 
> for a in range(130, 255):
>         print "\t<xsl:output-character character=\"&#%d;\"
>         string=\"&amp;#%d;\" />" % (a,a)
> 
> print "</xsl:character-map>"
> print "</xsl:stylesheet>"
> 
> and then tried xsl:including the document which this produces in the
> stylesheet which generates the new XML documents. The stylesheet runs
> fine but the foreign characters don't come out as entity references,
> just as normal characters.
> 
> Should what I'm trying to do work? Is there a way of doing it 
> which does
> work?
> 
> Thanks,
> Richard
> -- 
>   Richard Lewis
>   richardlewis@xxxxxxxxxxxxxx

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.