[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] Output Arrow Symbols - only 2 of 3 methods work ??

Subject: [xsl] Output Arrow Symbols - only 2 of 3 methods work ??
From: jdgarrett@xxxxxxxxxx
Date: Tue, 6 Aug 2002 12:58:11 -0500

So here is the issue:

I am trying to output buttons with arrow symbols
on them (← through ←).

I am able to output buttons with arrows using
Method 1 and Method 2, but not Method 3.
Method 3 just output's question marks.

I need Method 3.


The iMode post in the past couple of weeks
ran into similar obstacle getting only question

If the "only" answer to this issue is that the
parser loads and parses the xml doc and thereby
changes my original data, then why doesn't it change
it consistently across all methods.

Method 1.)

Direct reference of xsl style sheet from within the xml document

a.) Save xml and xsl source to 1.xml and 1.xsl file
b.) Open 1.xml inside of Internet Explorer

1.xml Source file.)

<?xml version="1.0" encoding="windows-1252"?>
<?xml:stylesheet type="text/xsl" href="1.xsl" ?>
 <Part date="2002_0805" time="0730">ABC123</Part>

1.xsl Source file.)

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"   xmlns:msxsl="urn:schemas-microsoft-com:xslt">
<xsl:template match="/">
<button id="idArrowButtonLeft">&#8592;</button>
<button id="idArrowButtonUp">&#8593;</button>
<button id="idArrowButtonRight">&#8594;</button>
<button id="idArrowButtonDown">&#8595;</button>

Method 1 Output.)

You get 4 buttons with each having an arrow symbol


Method 2.)


Using JavaScript to load both the xml and xsl source and then create
a processor and then using the transform method, output the resultant
transformation to a div tag to view in the current instance of the browser.
Note: save htmSource into a htm text file then open in browser.
Then save off xml and xsl source in Method 1.
Then open and transform the xml and xsl in Method 1 using the saved
htmSource htm file.

The following is the HTM Source.)


 font-family: Verdana;

 font-family: Verdana;


 var XMLFileName = '';
 var XSLFileName = '';

 function LoadFiles()
   XMLFileName  = XMLFile.value;
   XSLFileName  = XSLFile.value;

 function transformXML()

   var objSrcTree = new ActiveXObject('MSXML2.DOMDocument.4.0');
   objSrcTree.setProperty("NewParser", true );
   objSrcTree.async = false;

   var objXSLT = new ActiveXObject('MSXML2.DOMDocument.4.0');
   objXSLT.setProperty("NewParser", true );
   objXSLT.async = false;

   var pbSuccessfulXMLLoad = objSrcTree.load(XMLFileName);

   var pbSuccessfulXSLLoad = objXSLT.load(XSLFileName);

   var strResult = "";
   strResult = objSrcTree.transformNode(objXSLT);
   alert('result = ' + strResult);
   document.getElementById("idDiv").innerHTML = strResult;



<BODY leftMargin="0" topMargin="0" bgcolor="#FFFFFF" >

<tr><td><input name="XMLFile" type="file" class="clsButton2"
<tr><td><input name="XSLFile" type="file" class="clsButton2"
<tr><td><button class="clsButton1" onClick="LoadFiles()">Load
<tr><td><button class="clsButton1" onClick="transformXML()">Transform
<tr><td height="50"></td></tr>

<div id="idDiv"></div>


'//end htmSource

Method 2.) Output: You get 4 buttons with each having an arrow symbol.


Method 3.)

This method will only output question marks.

Note: cut and past into a new VB6 project and then call the function.
Make sure you reference MSXML 4.0 parser in your VB6 references section

// begin visual basic funtion

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""
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>&#8592;</button>"
psStrXSL = psStrXSL & vbCrLf & "<button>&#8592;</button>"
psStrXSL = psStrXSL & vbCrLf & "<button>&#8592;</button>"
psStrXSL = psStrXSL & vbCrLf & "<button>&#8592;</button>"
psStrXSL = psStrXSL & vbCrLf & "</xsl:template>"
psStrXSL = psStrXSL & vbCrLf & "</xsl:stylesheet>"

pbLoadError = XSLDoc.loadXML(psStrXSL)

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
MsgBox ("error = " & Err.Description)
End Function

//end VisualBasic function

Method 3 Output.)

When you load the result.htm page, you get 4 buttons with question marks.

Note: if you query the XSLDoc after loadXML you get

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
    <xsl:template match="/">

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread