Solved

call vbscript functions in xml or xsl

Posted on 2004-04-20
3
754 Views
Last Modified: 2011-09-20
Hi

How can i call a user vbscript functions(asp pages) from a xml/xsl files??
0
Comment
Question by:ybaron
3 Comments
 
LVL 10

Accepted Solution

by:
Yury_Delendik earned 125 total points
ID: 10868590
You can pass object as  parameter and use function from that object in xslt:

Class TestObj
   Public Function tt()
      tt ="test"
   End Function
End Class

....

   Set xsltemp.stylesheet = xsldoc.documentElement
   Set xslproc = xsltemp.createProcessor
   xmldoc.resolveExternals = false
   xmldoc.loadXML "<dummy>xml</dummy>"
   xslproc.input = xmldoc

   Dim t
   Set t = New TestObj

   xslproc.addObject t, "urn:my-object"
   xslproc.Transform
   MsgBox xslproc.output


XSLT file:

<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:my="urn:my-object" exclude-result-prefixes="my">
  <xsl:template match="/">
     <t><xsl:value-of select="my:tt()" /></t>
  </xsl:template>
</xsl:stylesheet>


It outputs: <t>test</t>
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The Problem How to write an Xquery that works like a SQL outer join, providing placeholders for absent data on the outer side?  I give a bit more background at the end. The situation expressed as relational data Let’s work through this.  I’ve …
Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question