Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: TransformXML files stored as USC-2 rather than UTF-8 [Thread Next] Re: TransformXML files stored as USC-2 rather than UTF-8To: NULL Date: 9/14/2006 2:28:00 PM
"Nick" <Nick@d...> wrote in message
news:81A53C1C-A7D3-4B86-AD67-0D54D0C68FB1@m......
> The code I am using is
>
> Application.ExportXML _
> ObjectType:=acExportTable, _
> DataSource:="Testlet_Entry", _
> DataTarget:=strTempXML, _
> Encoding:=acUTF8, _
> WhereCondition:="Testlet_Id=4350", _
> AdditionalData:=objOrderInfo
>
> This produces strTempXML in UTF-8 format, followed by
>
> Application.TransformXML strTempXML, _
> strXSLDirectory & "Testlet_Entry_Out.xsl", strSourceDirectory &
> "Testlet_Entry.xml"
Here is a VBScript version ot TransformXML :-
Function TransformXML(sFileIn, sXSLFile, sFileOut)
Dim domIn : Set domIn = GetDOM(sFileIn)
Dim domXSL : Set domXSL = GetDOM(sXSLFile)
Dim domOut : Set domOut = GetDOM("")
domIn.transformNodeToObject domXSL, domOut
domOut.save(sFileOut)
End Function
Function GetDOM(sFile)
Set GetDOM = CreateObject("MSXML2.DOMDocument.3.0")
GetDOM.async = false
If sFile <> "" Then GetDOM.load sFile
End Function
What happens if you use this function instead?
>
> Which transforms strTempXML in UTF-8 format into Testlet_Entry.xml in
USC-2
> format. The XSL Testlet_Entry_Out.xsl is as follows.
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="1.0">
> <xsl:output method="xml" encoding="utf-8" media-type="text/xml"
indent="yes"/>
>
> <xsl:template match="dataroot">
> <test>
> <xsl:apply-templates select="Testlet_Entry"/>
> </test>
> </xsl:template>
>
>
> "Anthony Jones" wrote:
>
> >
> > "Nick" <Nick@d...> wrote in message
> > news:7EFEC7B0-C48C-40A5-A432-BFF08C5A4F24@m......
> > > I am trying to export tables in access to transformed XML. I am using
> > >
> > > Application.ExportXML
> > >
> > > followed by
> > >
> > > Application.TransformXML
> > >
> > > The file produced from export is UTF-8 Cookie, but when I transform it
> > with
> > > Application.TransformXML with a style sheet that starts with the
> > following I
> > > get a USC-2 file instead of the required UTF-8 file.
> > >
> > > <?xml version="1.0" encoding="UTF-8"?>
> > > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> > > version="1.0">
> > > <xsl:output method="xml" encoding="utf-8" media-type="text/xml"
> > indent="yes"/>
> > >
> > > I am determining the encoding of the file from a text editor.
> > >
> > > I have tried using MSXML2 and XMLWriter
> > >
> > > Dim XMLDoc As MSXML2.DOMDocument
> > > Dim XSLDoc As MSXML2.FreeThreadedDOMDocument
> > > Dim XSLProcessor As MSXML2.IXSLProcessor
> > > Dim Str = New Stream
> > >
> > > to set the encoding but they all require a stream data type to read
the
> > file
> > > that I do not seem to be able to access in the VBA access.
> > >
> > > All the documentation
> > >
> > > 1) Set the encoding for TransformXML
> > > 2) Set the default encoding to UTF-8
> > > 3) How to use streaming in VBA
> > > 4) Any other ideas?
> >
> >
> > We really need to see the code where you actually generate the output as
> > save it to the file.
> >
> >
> > >
> >
> >
> >
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
