[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.3

Is there a pure xslt date format solution (MSXML processor) instead of current vbscript date functions

Asked by GessWurker in Extensible Stylesheet Language Transformation (XSLT), Active Server Pages (ASP), VB Script

Tags: xls, xml, asp, vbscript, msxml processor

If possible I'd like to convert an existing vbscript-dependant xlst to pure xlst. The problem is date formatting. I use some vbscript date functions to generate current date-time. See my incoming xml, xls, transformed xml, and msxml-reliant vbscript below. How can I convert the existing xls so that it doesn't need the embedded date format functions? At least one user has complained that the functions caused runtime errors on his setup. See the asp page here: http://ww2.timothyemerson.com:8080/workshop/navo/test6.asp
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
227:
228:
229:
230:
231:
232:
233:
234:
235:
236:
237:
238:
239:
240:
241:
242:
243:
244:
245:
246:
247:
248:
249:
250:
251:
252:
253:
254:
255:
256:
257:
258:
259:
260:
261:
262:
263:
264:
265:
266:
267:
268:
269:
270:
271:
272:
273:
274:
275:
276:
277:
278:
279:
280:
281:
282:
283:
284:
285:
286:
287:
288:
289:
290:
291:
292:
293:
294:
295:
296:
297:
298:
299:
300:
301:
302:
303:
304:
305:
306:
307:
308:
309:
310:
311:
312:
313:
314:
315:
316:
317:
318:
319:
320:
321:
322:
323:
324:
325:
326:
327:
328:
329:
330:
331:
332:
333:
334:
335:
336:
337:
338:
339:
340:
341:
342:
343:
344:
345:
346:
347:
348:
349:
350:
351:
352:
353:
354:
355:
356:
357:
358:
359:
360:
361:
362:
363:
364:
365:
366:
367:
368:
369:
370:
371:
372:
373:
374:
375:
376:
377:
378:
379:
380:
381:
382:
383:
384:
385:
386:
387:
388:
389:
390:
391:
392:
xml received:
<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
<inm:Results productTitle="Inmagic CS/WebPublisher PRO" productVersion="11.00" xmlns:inm="http://www.inmagic.com/webpublisher/query" oex="ISO-8859-1">
<inm:QY>find (CatID=10)</inm:QY>
<inm:Recordset AC="QBE_QUERY" sn="AUTO14082" se="508" queryCount="1" page="1" pageCount="1" setCount="1">
<inm:Record setEntry="0">
<inm:CatID>10</inm:CatID>
<inm:CatCallNumber />
<inm:CatTitle>ACOUSTIC PROPERTIES OF GAS BUBBLES IN A LIQUID.</inm:CatTitle>
<inm:CatSubtitle />
<inm:CatAlternateTitle />
<inm:CatAuthor>SPITZER, LYMAN, JR</inm:CatAuthor>
<inm:CatCorporateAuthor>COLUMBIA UNIV NEW YORK</inm:CatCorporateAuthor>
<inm:CatResponsibility />
<inm:CatEditor />
<inm:CatEdition />
<inm:CatSource />
<inm:CatPlace />
<inm:CatPublisher />
<inm:CatDatePublished>430715</inm:CatDatePublished>
<inm:CatPhysDesc>62</inm:CatPhysDesc>
<inm:CatSeries />
<inm:CatSubjects>(*BUBBLES)</inm:CatSubjects>
<inm:CatSubjects>ACOUSTIC PROPERTIES</inm:CatSubjects>
<inm:CatSubjects>LIQUIDS</inm:CatSubjects>
<inm:CatAbstract />
<inm:CatNotes />
<inm:CatISBN />
<inm:CatISSN />
<inm:CatLanguage />
<inm:CatRecordType />
<inm:CatStatus />
<inm:CatLocation>REPORTS</inm:CatLocation>
<inm:CatLCCard />
<inm:CatSerFrequency />
<inm:CatSerIssuesPerVol />
<inm:CatSerHoldings />
<inm:CatSerSpecialIssues />
<inm:CatSerIndexedIn />
<inm:CatSerRetention />
<inm:CatURL />
<inm:CatUrlNotes />
<inm:CatImage />
<inm:CatFileName />
<inm:CatFullText />
<inm:CatDateCataloged />
<inm:CatDateApproved />
<inm:CatDateCreated>11/12/2008</inm:CatDateCreated>
<inm:CatDateModified>12/10/2008</inm:CatDateModified>
<inm:CatNVACCN>AD-127 977</inm:CatNVACCN>
<inm:CatNVDIST />
<inm:CatNVIDEN />
<inm:CatNVREPN />
<inm:CatNVTCLS />
<inm:CatNVRCLS>U</inm:CatNVRCLS>
<inm:CatNVACLS />
<inm:CatNVDCLS>U</inm:CatNVDCLS>
<inm:CatNVICLS />
<inm:CatNVMONA>OSRD</inm:CatNVMONA>
<inm:CatNVMONS>1705</inm:CatNVMONS>
<inm:CatNVOSOR />
<inm:CatNVPROJ />
<inm:CatNVCHGA />
<inm:CatNVGRP />
<inm:CatNVDISC />
<inm:CatNVTASK />
<inm:CatNVECLS />
<inm:CatNVNOTE />
<inm:CatNVSORC />
<inm:CatNVPRIC />
<inm:CatNVGEOC />
<inm:CatNVINV />
<inm:CatNVANOT />
<inm:CatNVTYPC />
<inm:CatNVCONN>OEMSR20</inm:CatNVCONN>
<inm:CatNVRecFormat>TECHRPT</inm:CatNVRecFormat>
<inm:CatNVDissNote />
</inm:Record>
</inm:Recordset>
</inm:Results>
*************************
current xls:
<?xml version="1.0"?>
<xsl:stylesheet version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msxsl="urn:schemas-microsoft-com:xslt"
                xmlns:dates="urn:www.timothyemerson.com:dates" xmlns:inm="http://www.inmagic.com/webpublisher/query" xmlns:inmg="www.inmagic.com/genie" exclude-result-prefixes="xsi xsl inm inmg xs msxsl dates">
  <xsl:output method="xml" indent="yes"/>
  <msxsl:script language="vbscript" implements-prefix="dates"><![CDATA[
            function longDate()
            longDate = Date & " " & Time
            end function
 
            function shortDate()
            shortDate = Day(Date) & " " & MonthName(DatePart("m",Date),true) & " " & Year(Date)
            end function
          ]]>
  </msxsl:script>
  <xsl:strip-space elements="*"/>
  <xsl:template match="/">
    <xsl:apply-templates select="//inm:Results/inm:Recordset/inm:Record"/>
  </xsl:template>
  <xsl:template match="//inm:Results/inm:Recordset/inm:Record">
    <Citation type="tr">
      <xsl:attribute name="type">
        <xsl:choose>
          <xsl:when test="inm:CatNVRecFormat = 'TECHRPT'">
            <xsl:value-of select="string('tr')"/>
          </xsl:when>
          <xsl:when test="inm:CatNVRecFormat = 'MUSIC'">
            <xsl:value-of select="string('music')"/>
          </xsl:when>
          <xsl:when test="inm:CatNVRecFormat = 'MANUSCRPT'">
            <xsl:value-of select="string('manu')"/>
          </xsl:when>
          <xsl:when test="inm:CatNVRecFormat = 'MAP'">
            <xsl:value-of select="string('map')"/>
          </xsl:when>
          <xsl:otherwise>
            <xsl:value-of select="string('tr')"/>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:attribute>
      <xsl:for-each select="inm:CatNVACCN">
        <AccessionNumber>
          <xsl:value-of select="."/>
        </AccessionNumber>
      </xsl:for-each>
      <DateGenerated shortDate="">
        <xsl:attribute name="shortDate">
          <xsl:value-of select="dates:shortDate()"/>
        </xsl:attribute>
        <xsl:value-of select="dates:longDate()"/>
      </DateGenerated>
      <CitationStatus code="A">Active</CitationStatus>
      <CitationClassification code="U">Unclassified</CitationClassification>
      <xsl:for-each select="inm:CatCorporateAuthor">
        <CorporateAuthor>
          <xsl:value-of select="."/>
        </CorporateAuthor>
      </xsl:for-each>
      <xsl:for-each select="inm:CatTitle">
        <UnclassifiedTitle>
          <xsl:value-of select="."/>
        </UnclassifiedTitle>
        <TitleClassification code="U">Unclassified</TitleClassification>
      </xsl:for-each>
 
      <xsl:for-each select="inm:CatDatePublished">
        <xsl:if test="string(.)">
          <ReportDate>
            <xsl:value-of select="."/>
          </ReportDate>
        </xsl:if>
      </xsl:for-each>
      <xsl:for-each select="inm:CatPhysDesc">
        <xsl:if test="string(.)">
          <PaginationOrMediaCount>
            <xsl:value-of select="."/>
          </PaginationOrMediaCount>
        </xsl:if>
      </xsl:for-each>
      <xsl:for-each select="inm:CatNVDIST">
        <xsl:if test="string(.)">
          <DistributionCode code="01">
            <xsl:value-of select="."/>
          </DistributionCode>
        </xsl:if>
      </xsl:for-each>
      <xsl:for-each select="inm:CatNVREPN">
        <xsl:if test="string(.)">
          <ReportNumber>
            <xsl:attribute name="nonPunctuated">
              <xsl:value-of select="normalize-space(translate(., '+-|!~:{}[]^?()*.', ''))"/>
            </xsl:attribute>
            <xsl:value-of select="."/>
          </ReportNumber>
        </xsl:if>
      </xsl:for-each>
      <xsl:for-each select="inm:CatAbstract">
        <xsl:if test="string(.)">
          <Abstract>
            <xsl:value-of select="."/>
          </Abstract>
        </xsl:if>
      </xsl:for-each>
      <xsl:if test="inm:CatAbstract != ''">
        <AbstractClassification code="U">Unclassified</AbstractClassification>
      </xsl:if>
      <xsl:for-each select="inm:CatSubjects">
        <xsl:if test="string(.)">
          <Descriptor>
            <xsl:value-of select="."/>
          </Descriptor>
        </xsl:if>
      </xsl:for-each>
      <xsl:if test="inm:CatSubjects != ''">
        <DescriptorClassification code="U">Unclassified</DescriptorClassification>
      </xsl:if>
      <xsl:for-each select="inm:CatNotes">
        <xsl:if test="string(.)">
          <DescriptiveNote>
            <xsl:value-of select="."/>
          </DescriptiveNote>
        </xsl:if>
      </xsl:for-each>
      <xsl:for-each select="inm:CatAuthor">
        <xsl:if test="string(.)">
          <PersonalAuthor>
            <xsl:value-of select="."/>
          </PersonalAuthor>
        </xsl:if>
      </xsl:for-each>
      <xsl:for-each select="inm:CatNVIDEN">
        <xsl:if test="string(.)">
          <Identifier>
            <xsl:value-of select="."/>
          </Identifier>
        </xsl:if>
      </xsl:for-each>
      <xsl:if test="inm:CatNVIDEN != ''">
        <IdentifierClassification code="U">Unclassified</IdentifierClassification>
      </xsl:if>
      <xsl:for-each select="inm:CatNVMONA">
        <xsl:if test="string(.)">
          <MonitorAcronym>
            <xsl:value-of select="."/>
          </MonitorAcronym>
        </xsl:if>
      </xsl:for-each>
      <xsl:for-each select="inm:CatNVMONS">
        <xsl:if test="string(.)">
          <MonitorSeries>
            <xsl:value-of select="."/>
          </MonitorSeries>
        </xsl:if>
      </xsl:for-each>
      <ReportClassification code="U">Unclassified</ReportClassification>
      <DistributionCode code="01">APPROVED FOR PUBLIC RELEASE</DistributionCode>
      <xsl:for-each select="inm:CatNVTASK">
        <xsl:if test="string(.)">
          <TaskNumber>
            <xsl:value-of select="."/>
          </TaskNumber>
        </xsl:if>
      </xsl:for-each>
      <xsl:for-each select="inm:CatNVOSOR">
        <xsl:if test="string(.)">
          <CatNVOSOR>
            <xsl:value-of select="."/>
          </CatNVOSOR>
        </xsl:if>
      </xsl:for-each>
      <xsl:for-each select="inm:CatNVGRP">
        <xsl:if test="string(.)">
          <CatNVGRP>
            <xsl:value-of select="."/>
          </CatNVGRP>
        </xsl:if>
      </xsl:for-each>
      <xsl:for-each select="inm:CatNVCONN">
        <xsl:if test="string(.)">
          <ContractNumber>
            <xsl:value-of select="."/>
          </ContractNumber>
        </xsl:if>
      </xsl:for-each>
      <xsl:for-each select="inm:CatNVINV">
        <xsl:if test="string(.)">
          <CatNVINV>
            <xsl:value-of select="."/>
          </CatNVINV>
        </xsl:if>
      </xsl:for-each>
    </Citation>
  </xsl:template>
</xsl:stylesheet>
*********************
xml transformed:
<?xml version="1.0" encoding="UTF-16"?>
<Citation type="tr">
<AccessionNumber>AD-127 977</AccessionNumber>
<DateGenerated shortDate="22 Jan 2009">1/22/2009 1:18:23 AM</DateGenerated>
<CitationStatus code="A">Active</CitationStatus>
<CitationClassification code="U">Unclassified</CitationClassification>
<CorporateAuthor>COLUMBIA UNIV NEW YORK</CorporateAuthor>
<UnclassifiedTitle>ACOUSTIC PROPERTIES OF GAS BUBBLES IN A LIQUID.</UnclassifiedTitle>
<TitleClassification code="U">Unclassified</TitleClassification>
<ReportDate>430715</ReportDate>
<PaginationOrMediaCount>62</PaginationOrMediaCount>
<Descriptor>(*BUBBLES)</Descriptor>
<Descriptor>ACOUSTIC PROPERTIES</Descriptor>
<Descriptor>LIQUIDS</Descriptor>
<DescriptorClassification code="U">Unclassified</DescriptorClassification>
<PersonalAuthor>SPITZER, LYMAN, JR</PersonalAuthor>
<MonitorAcronym>OSRD</MonitorAcronym>
<MonitorSeries>1705</MonitorSeries>
<ReportClassification code="U">Unclassified</ReportClassification>
<DistributionCode code="01">APPROVED FOR PUBLIC RELEASE</DistributionCode>
<ContractNumber>OEMSR20</ContractNumber>
</Citation>
*********************
vbscript (test6.asp):
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%Response.Buffer = False%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Test Transform</title>
</head>
 
<body>
<%
'Initialise variables
Dim oXMLHTTP
Dim oResponseXML
Dim bXMLLoadError
Dim xmlURL
Dim serverName
Dim fso, file
Dim strPath
Const ForWriting = 2
 
inmQuery = "find+(CatID=10)"
'inmQuery = "find+(CatID+ct+5000:8000)"
 
xmlURL = "http://geniehost04.inmagic.com/ics-wpd/exec/icswppro.dll?TN=catalog&XML=1&TX=0&AC=QBE_QUERY&QY=" & inmQuery
 
Set oXMLHTTP = Server.CreateObject("Microsoft.XMLHTTP") 'Create instance of the Microsoft XMLHTTP object
 
'Use the Microsoft XMLHTTP object to retrieve the XML from the remote server
oXMLHTTP.Open "GET", xmlURL, false
oXMLHTTP.Send()
 
 'Turn off error handling
' On Error Resume Next
 
'Wait for up to 5 seconds if get no data
'  If oXMLHttp.readyState <> 4 then
'    oXMLHttp.waitForResponse 5
'  End If
 
'Check that the XML was retrieved successfully by checking to ensure that a HTTP status code of 200 was received (200 = OK)
If oXMLHTTP.Status = 200 Then
    Set oResponseXML = oXMLHTTP.ResponseXML 'Save XML to an object
	Response.Write("XML returned:<BR><BR><textarea name=xmlResponse rows=20 cols=130>"&oXMLHttp.ResponseText&"</textarea><BR><BR><BR>XML transformed:<BR><BR><textarea name=xmlResponse rows=20 cols=130>")
	bXMLLoadError = False
 
Else
    Response.Write("<font color=""red"">Page Error: Could not load XML from remote server</font><br>") 'Show error message
    bXMLLoadError = True
End If
 
If Not bXMLLoadError Then
 
    'Load the XML from the oResponseXML object
	Dim oXML
	Dim oXSL
	Dim xmlResult
   set oXML = Server.CreateObject("Microsoft.XMLDOM")
    oXML.Async = false
    oXML.Load(oResponseXML)
 
    'Load the XSL from disk
    set oXSL = Server.CreateObject("Microsoft.XMLDOM")
    oXSL.Async = False
    oXSL.Load(Server.MapPath("test6.xsl"))
 
'    using the transform below with the timothyemerson.com xmlUrl works properly
'    oXSL.Load(Server.MapPath("SchoolDiv.xsl"))
 
 xmlResult = oXML.transformNode(oXSL)
 
    Response.Write(xmlResult & "</TEXTAREA>") 'Transform the XML using the XSL stylesheet
 
 Set fso = CreateObject("Scripting.FileSystemObject")
 strPath = "e:\temp\testTrans1.txt"
 
  ' open the file
  Set file = fso.opentextfile(strPath, ForWriting, True)
 
  ' write the info to the file
  file.write xmlResult
 
  ' close and clean up
  file.Close
 
End If
Set oXMLHTTP = nothing 'Release Microsoft XMLHTTP object
%>
 
</body>
</html>
[+][-]01/21/09 10:31 PM, ID: 23437025Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/21/09 10:35 PM, ID: 23437051Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01/21/09 10:39 PM, ID: 23437069Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01/21/09 10:50 PM, ID: 23437116Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zones: Extensible Stylesheet Language Transformation (XSLT), Active Server Pages (ASP), VB Script
Tags: xls, xml, asp, vbscript, msxml processor
Sign Up Now!
Solution Provided By: hielo
Participating Experts: 1
Solution Grade: A
 
[+][-]01/21/09 10:52 PM, ID: 23437123Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091021-EE-VQP-81 - Hierarchy / EE_QW_3_20080625