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

Multibyte output


sqlplus select
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></xsl: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></xsl: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>



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
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

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.