OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   RE: [xml-dev] Multibyte output

[ Lists Home | Date Index | Thread Index ]

You're probably running on the Microsoft platform and you're probably
sending the output to a character stream not a byte stream, which means that
it's not XSLT that's encoding the characters as bytes but some other bit of
software further downstream.

Michael Kay
Software AG
home: Michael.H.Kay@ntlworld.com
work: Michael.Kay@softwareag.com

> -----Original Message-----
> From: Cutler, Dan [mailto:Dan.Cutler@vacationclub.com]
> Sent: 07 May 2002 22:04
> To: xml-dev@lists.xml.org
> Subject: [xml-dev] Multibyte output
>
>
> I am getting really strange output from this XSL transform.
>
> The output  *looks* perfect - however, each character looks
> as though it was
> prodced in UTF-16 (each char is represented in two byes with
> a leading 00
> byte).  Also, the files begins with a char 127 and char
> 126???  I explicitly
> set the encoding to UTF-8 but it still doesn't work.  Trying
> to save the
> output as a ".sql" and then ruunning it in sqlplus fails.
>
> Anyone have any ideas?
>
> The XSL follows:
>
> <?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" indent="no"/>
> <xsl:variable name="digits" select='-01234567809'/>
> <xsl:template match="Import">
> 	<xsl:text></xsl:text>
> 	<xsl:for-each select="Row">
> 		<xsl:text>&#10;</xsl:text>
> 		<xsl:text>insert into customer_0_A (</xsl:text>
> 		<xsl:for-each select="*">
> 			<xsl:value-of select="name(.)"/>
> 			<xsl:choose><xsl:when
> test="position()!=last()"><xsl:text>,</xsl:text></xsl:when></x
> sl:choose>
> 		      	<xsl:text>&#10;</xsl:text>
> 		</xsl:for-each>
> 		<xsl:text>) &#10; values (</xsl:text>
> 		<xsl:for-each select="*">
> 		      <xsl:choose>
> 		     		<xsl:when
> test="not(contains($digits,substring(normalize-space(.),1,1)))">
> 		     		<xsl:text>'</xsl:text>
> 		     		</xsl:when>
> 		     	</xsl:choose>
> 			<xsl:value-of select="."/>
> 		      <xsl:choose><xsl:when
> test="not(contains($digits,substring(normalize-space(.),1,1)))
> "><xsl:text>'<
> /xsl:text></xsl:when></xsl:choose>
> 		      	<xsl:choose><xsl:when
> test="position()!=last()"><xsl:text>,</xsl:text></xsl:when></x
> sl:choose>
> 		      	<xsl:text>&#10;</xsl:text>
> 		</xsl:for-each>
> 		<xsl:text>); &#10;</xsl:text>
> 	</xsl:for-each>
> </xsl:template>
> </xsl:stylesheet>
>
> The transform takes the XML (at bottom) and produces insert statements
> for Oralce.
>
> The only thing that made this tough was trying to figure out
> how/when to put
> quotes around strings :-)
>
>
> A snippet of XML file:
>
> <!-- edited with XML Spy v4.3 U (http://www.xmlspy.com) by Cutler, Dan
> (private) -->
> <?xml-stylesheet type="text/xsl"
> href="C:\TEMP\CME\test_data_import.xsl"?>
> <Import>
> 	<Row>
> 		<CUSTOMER_KEY>2</CUSTOMER_KEY>
> 		<_DATE_MODIFIED>  sysdate</_DATE_MODIFIED>
> 		<_LATEST_FLAG> 1</_LATEST_FLAG>
> 		<_NAME_FIRST>Joe</_NAME_FIRST>
> 		<_NAME_LAST>Bloe</_NAME_LAST>
> 		<_GENDER>Male</_GENDER>
> 		<_TITLE>UNKNOWN</_TITLE>
> 		<_ADDRESS>UNKNOWN</_ADDRESS>
> 		<_CITY>UNKNOWN</_CITY>
> 		<_STATE_PROVINCE>UNKNOWN</_STATE_PROVINCE>
> 		<_ZIPCODE>UNKNOWN</_ZIPCODE>
> 		<_COUNTY>UNKNOWN</_COUNTY>
> 		<_COUNTRY>UNKNOWN</_COUNTRY>
> ...
>         </Row>
> </Import>
>
>
>
> -----------------------------------------------------------------
> The xml-dev list is sponsored by XML.org <http://www.xml.org>, an
> initiative of OASIS <http://www.oasis-open.org>
>
> The list archives are at http://lists.xml.org/archives/xml-dev/
>
> To subscribe or unsubscribe from this list use the subscription
> manager: <http://lists.xml.org/ob/adm.pl>
>





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS