开发者

Getting Type Mismatch Issue while Adding parameter to XSLT using VBScript

I have got below code开发者_开发技巧 in VBScript:

<%

Option Explicit  

#importXSLT "tcm:228-190529-2048" As expandXSLT
#importXSLT "tcm:228-642694-2048" As renderXSLT

Dim xml, currentDateTime

Set xml = getNewDomDocument()
xml.loadXML TDSE.GetListPublications(3)

expandXSLT.input = xml
Call expandXSLT.addParameter("publication", Component.Publication.Id)
expandXSLT.transform

xml.loadXML(expandXSLT.output)
'WriteOut xml.xml

currentDateTime = now
renderXSLT.input = xml
Call renderXSLT.addParameter("currentPublishedDate", currentDateTime)
renderXSLT.transform

WriteOut renderXSLT.output

Set xml = Nothing

%>

You can see there is two syntax where I am adding the XSLT parameter, the first one is working fine i.e.

expandXSLT.input = xml
Call expandXSLT.addParameter("publication", Component.Publication.Id)
expandXSLT.transform

However the new requirement was that, we need to send current date time from here to the XSLT, so I have added the same logic to send the current date & time to my XSLT, below is code added by me

 currentDateTime = now
    renderXSLT.input = xml
    Call renderXSLT.addParameter("currentPublishedDate", currentDateTime)
    renderXSLT.transform

But when I am trying to run the above code its giving below error:

Type mismatch. (source: Call renderXSLT.addParameter("publishedDate", currentDateTime)).

Please suggest!!


Try whether converting the currentDateTime value you have to a string first to pass that string to XSLT e.g. CStr(currentDateTime).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜