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

RE: Special characters and Transformation

Subject: RE: Special characters and Transformation
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 5 May 2006 10:34:43 +0100
xsl using special character german
(1) using encoding="us-ascii" on xsl:output will force non-ASCII characters
to be represented using numeric character references. They won't necessarily
be identical to those in your input, for example they may be decimal rather
than hex or vice versa. (If you're using Saxon, there's an extension that
gives you control over this)

(2) need to see your code to see what you're doing wrong to get this effect.

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

> -----Original Message-----
> From: Khorasani, Houman [mailto:Houman.Khorasani@xxxxxxxxxxxx]
> Sent: 05 May 2006 10:20
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Special characters and Transformation
>
> Hello,
>
> I have two questions:
>
> 1) If I have an XML input file like this:
>
> <root>
> 	<Text>
> 		<junk>xxx</junk>
> 		<tag>Als die ersten St&#228;dte zu einer
> Gr&#246;&#223;e heranwuchsen</tag>
> 		<junk2>xxx</junk2>
> 	</Text>
> </root>
>
> I would like to skip the <junk> only transform the <tag>;
> however the output shall still have the special character as
> it is there in the input file. Unfortunately the special
> characters get translated into the proper German characters.
>
> That is:
> <root>
> 	<Text>
> 		<tag>Als die ersten Stddte zu einer Grv_e
> heranwuchsen</tag>
> 	</Text>
> </root>
>
>
> This is my XSLT:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> 	<xsl:output method="text" version="1.0"
> encoding="UTF-8" indent="yes"/>
> 	<xsl:template match="/">
> 		<xsl:element name="root">
> 			<xsl:for-each select="Text">
> 				<xsl:element name="Text">
> 					<xsl:element name="tag">
> 						<xsl:value-of
> select="tag"/>
> 					</xsl:element>
> 				</xsl:element>
> 			</xsl:for-each>
> 		</xsl:element>
> 	</xsl:template>
> </xsl:stylesheet>
>
> How can I avoid it?
>
> 2) If I had a namespace on the root:
>
> <root xmlns="http://www.fo.com">
> 	<Text>
> 		<junk>xxx</junk>
> 		<tag>Als die ersten St&#228;dte zu einer
> Gr&#246;&#223;e heranwuchsen</tag>
> 		<junk2>xxx</junk2>
> 	</Text>
> </root>
>
> The way I do it (not shown here) is that I get the namespace
> behind each single tag.  But how do I modify my XSL so that
> the output is like this:
>
> <root xmlns="http://www.fo.com">
> 	<Text>
> 		<tag>Als die ersten St&#228;dte zu einer
> Gr&#246;&#223;e heranwuchsen </tag>
> 	</Text>
> </root>
>
> Many Thanks for help,
> Houman

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.