Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries [Thread Prev] >Thread Next - Re: function vbscript inside xsl function vbscript inside xslTo: NULL Date: 6/1/2006 7:03:00 PM
I'm really in Hard situation:
I must create a function able to get the currency value from an xml
source.
The function it will be similar to the following:
after in a xsl stylesheet I must call the function in this way:
<msxsl:script language=VbScript" implements-prefix="vb">
<![CDATA[
function getCurrency(CODE)
Dim XmlDocument, Rate
Set XmlDocument = CreateObject("Msxml2.DOMDocument.3.0")
XmlDocument.async = False
If XmlDocument.load("valute1.xml") Then
XmlDocument.setProperty "SelectionLanguage", "XPath"
Set Rate =
XmlDocument.selectSingleNode("/CommandList/GetCurrencies/CurrencyList/Currency/Code[.
= 'CODE']/following-sibling::UsdRate[1]/text()")
If Not Rate Is Nothing Then
Document.write "Rate is " & Rate.data
Else
Document.write "No rate found."
End If
Else
Document.write "Parse error: " & _
XmlDocument.parseError.reason
End If
END FUNCTION
]]>
</msxsl:script>
<xsl:variable name="value_currency"
select="="{vb:getCurrency(Price/Currency)}"/>
<xsl:value-of select="(Price/Amount) / $value_currency" />
In this way it must to find the code currency e.g 'NOK' and get the
relative value e.g 89.7704 and then do a conversion from NOK to USD.
But It' doesnt work :)
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
