This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Output Arrow Symbols - only 2 of 3 methods work ??
- From: jdgarrett at alltel dot net
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Wed, 7 Aug 2002 07:40:02 -0500
- Subject: RE: [xsl] Output Arrow Symbols - only 2 of 3 methods work ??
- Reply-to: xsl-list at lists dot mulberrytech dot com
|-----Original Message-----
|From: owner-xsl-list@lists.mulberrytech.com
|[mailto:owner-xsl-list@lists.mulberrytech.com]On Behalf Of Mike Brown
|Sent: Tuesday, August 06, 2002 1:39 PM
|To: xsl-list@lists.mulberrytech.com
|Subject: Re: [xsl] Output Arrow Symbols - only 2 of 3 methods work ??
|
|
|jdgarrett@alltel.net wrote:
|> Dim psFile As String
|> psFile = App.Path & "\result.htm"
|> pnFileNum = FreeFile()
|> Open psFile For Append Access Write As pnFileNum
|
|I don't know VB but I am guessing that your problem has to do with
|how you you
|are sending psOutput, which is probably a Unicode (UTF-16) string,
|to a file
|on disk. The raw UTF-16 data is probably not being written
|directly. I bet the
|16-bit characters are being serialized in an 8-bit encoding like
|windows-1252
|(cp1252), and characters outside of the range of that encoding are being
|replaced with "?", as is the generally accepted practice when a process
|doesn't know that it's writing markup as opposed to just some arbitrary
|string. (If it knew it was writing markup, it would emit "←" in the
|8-bit encoding).
|
|I would check your VB docs for writing strings and files. Surely
|there will be
|something about encoding defaults and how to override them.
|
| - Mike
|___________________________________________________________________
|_________
| mike j. brown | xml/xslt: http://skew.org/xml/
| denver/boulder, colorado, usa | resume: http://skew.org/~mike/resume/
|
| XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Mike:
If you see the Note section below, I mention
in the original post that if you query
XSLDoc after the initial load, you get
question marks before any output ....
So XSLDoc is transforming the ← before
I can even access it for output ...
The complete function is quoted again below
(See Mike: Note below)
Public Function OutPutHTMLWithButtons()
On Error GoTo errorhandler
Dim psStrXML As String
Dim psStrXSL As String
Dim pbLoadError As Long
Dim psOutPut As String
Dim XMLDoc As MSXML2.DOMDocument40
Set XMLDoc = New MSXML2.DOMDocument40
XMLDoc.setProperty "NewParser", True
XMLDoc.async = False
Dim XSLDoc As MSXML2.DOMDocument40
Set XSLDoc = New MSXML2.DOMDocument40
XSLDoc.setProperty "NewParser", True
XSLDoc.async = False
psStrXML = "<?xml version=""1.0""?>"
psStrXML = psStrXML & vbCrLf & "<!-- <?xml:stylesheet type=""text/xsl""
href=""1.xsl""?> -->"
psStrXML = psStrXML & vbCrLf & "<Company>"
psStrXML = psStrXML & vbCrLf & "<Part date=""2002_0627""
time=""0730"">ABC123</Part>"
psStrXML = psStrXML & vbCrLf & "</Company>"
pbLoadError = XMLDoc.loadXML(psStrXML)
psStrXSL = "<?xml version=""1.0""?>"
psStrXSL = psStrXSL & vbCrLf & "<xsl:stylesheet
xmlns:xsl=""http://www.w3.org/1999/XSL/Transform"" version=""1.0"">"
psStrXSL = psStrXSL & vbCrLf & "<xsl:template match=""/"">"
psStrXSL = psStrXSL & vbCrLf & "<button>←</button>"
psStrXSL = psStrXSL & vbCrLf & "<button>←</button>"
psStrXSL = psStrXSL & vbCrLf & "<button>←</button>"
psStrXSL = psStrXSL & vbCrLf & "<button>←</button>"
psStrXSL = psStrXSL & vbCrLf & "</xsl:template>"
psStrXSL = psStrXSL & vbCrLf & "</xsl:stylesheet>"
pbLoadError = XSLDoc.loadXML(psStrXSL)
/////////////////////////////////////////////////////////////
Mike:
Note: if you query the XSLDoc after loadXML you get
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<button>?</button>
<button>?</button>
<button>?</button>
<button>?</button>
</xsl:template>
</xsl:stylesheet>
/////////////////////////////////////////////////////////////
psOutPut = XMLDoc.transformNode(XSLDoc)
MsgBox (psOutPut)
Dim pnFileNum
Dim psFile As String
psFile = App.Path & "\result.htm"
pnFileNum = FreeFile()
Open psFile For Append Access Write As pnFileNum
Print #pnFileNum, psOutPut
Close #pnFileNum
Exit Function
errorhandler:
MsgBox ("error = " & Err.Description)
End Function
//end VisualBasic function
'//==================================================
|
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list