473,624 Members | 2,458 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

vbscript and xsl

Hi,

I have a vbscript function and an xsl file and when the vbscript
function is ran it creats the xml value that the xsl file then
transforms. It was done by Sharepoint so I figure there must be a way
for writing this so it works in one asp file. Some way of running the
function then putting the xsl file to transform it and outputting the
results.

I tried putting the xsl into an xsl editor, and then the function into
an xml editor enclosed in the
<SCRIPT language="VBSCR IPT"><![CDATA[
tags but no joy.

Any advice greatly appreciated.

--------------------------------------------------------------
Function GetContent(nod)
On Error Resume Next
'code removed for simplicity'
response.write "<News>" & ..... & "</News>"
End Function

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:styleshe et version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" omit-xml-declaration="no " indent="yes"
encoding="utf-8" />
<xsl:template match="/">
<TABLE>
<xsl:for-each select="Name">
<TR>
<TD valign="top" align="left">
<b><a
href='http://link/'><xsl:value-of select="."/></a></b>
</TD>
</TR>
</xsl:for-each>
</TABLE>
</xsl:template>
</xsl:stylesheet>
Jul 19 '05 #1
3 3033
I'm really not sure how this is ASP related. I'd try to put this post in a
more appropriate forum. And when you do, you may want to be a little more
descriptive than "no joy." What does that mean? Are you getting an error?
If so, what? And when doing what? What results do you expect from the
action you're taking? What results are you getting instead? Stuff like
that.

Ray at work

"kieran" <ki********@hot mail.com> wrote in message
news:b3******** *************** ***@posting.goo gle.com...
Hi,

I have a vbscript function and an xsl file and when the vbscript
function is ran it creats the xml value that the xsl file then
transforms. It was done by Sharepoint so I figure there must be a way
for writing this so it works in one asp file. Some way of running the
function then putting the xsl file to transform it and outputting the
results.

I tried putting the xsl into an xsl editor, and then the function into
an xml editor enclosed in the
<SCRIPT language="VBSCR IPT"><![CDATA[
tags but no joy.

Any advice greatly appreciated.

--------------------------------------------------------------
Function GetContent(nod)
On Error Resume Next
'code removed for simplicity'
response.write "<News>" & ..... & "</News>"
End Function

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:styleshe et version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" omit-xml-declaration="no " indent="yes"
encoding="utf-8" />
<xsl:template match="/">
<TABLE>
<xsl:for-each select="Name">
<TR>
<TD valign="top" align="left">
<b><a
href='http://link/'><xsl:value-of select="."/></a></b>
</TD>
</TR>
</xsl:for-each>
</TABLE>
</xsl:template>
</xsl:stylesheet>

Jul 19 '05 #2
"kieran" <ki********@hot mail.com> wrote in message
news:b3******** *************** ***@posting.goo gle.com...
Hi,

I have a vbscript function and an xsl file and when the vbscript
function is ran it creats the xml value that the xsl file then
transforms. It was done by Sharepoint so I figure there must be a way
for writing this so it works in one asp file. Some way of running the
function then putting the xsl file to transform it and outputting the
results.

I tried putting the xsl into an xsl editor, and then the function into
an xml editor enclosed in the
<SCRIPT language="VBSCR IPT"><![CDATA[
tags but no joy.

Any advice greatly appreciated.

--------------------------------------------------------------
Function GetContent(nod)
On Error Resume Next
'code removed for simplicity'
response.write "<News>" & ..... & "</News>"
End Function

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:styleshe et version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" omit-xml-declaration="no " indent="yes"
encoding="utf-8" />
<xsl:template match="/">
<TABLE>
<xsl:for-each select="Name">
<TR>
<TD valign="top" align="left">
<b><a
href='http://link/'><xsl:value-of select="."/></a></b>
</TD>
</TR>
</xsl:for-each>
</TABLE>
</xsl:template>
</xsl:stylesheet>


Use the DOMDocument.loa dXML method instead of the DOMDocument.loa d method to
load the XSL document from a string. I don't envy the task, you're going to
have to escape all the quotes contained in the XSL document. Here's a link
to the documentation for loadXML:

http://www.msdn.microsoft.com/librar...mthloadXML.asp
Jul 19 '05 #3
Cheers for that Chris.

You pointed me in the right direction and i got it working.

Heres the code for others -

<%

'Removes the SERVER NAME that is returned with the USERNAME
strNTUser = Trim(Request.Se rverVariables(" LOGON_USER"))
iPos = Len(strNTUser) - InStr(1, strNTUser, "\", 1)
strNTUser = Right(strNTUser , iPos)
strSQLUser = Replace(strNTUs er,"_"," ")
strSQLUser=UCas e(strSQLUser)

Dim sXML
Dim oDoc
sXML = "<?xml version=""1.0"" ?><name>" & strSQLUser & "</name>"
'Call the function - server.mappath means the file is in the root.
'loadXMLFile server.MapPath( "test.xml"),ser ver.MapPath("te st.xsl")

loadXMLFile SXML,server.Map Path("test.xsl" )
Function loadXMLFile(str XMLFile, strXSLFile)

'Declare local variables
Dim objXML
Dim objXSL
'Instantiate the XMLDOM Object that will hold the XML file.
set objXML = Server.CreateOb ject("Microsoft .XMLDOM")

'Turn off asyncronous file loading.
objXML.async = false

'Load the XML file.
objXML.loadXML( strXMLFile)
'Instantiate the XMLDOM Object that will hold the XSL file.
set objXSL = Server.CreateOb ject("Microsoft .XMLDOM")

'Turn off asyncronous file loading.
objXSL.async = false

'Load the XSL file.
objXSL.load(str XSLFile)
'Use the "transformN ode" method of the XMLDOM to apply the
'XSL stylesheet to the XML document. Then the output is
'written to the client.
Response.Write( objXML.transfor mNode(objXSL))
End Function

%>
Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
6818
by: John Davis | last post by:
When I create new documents in Dreamweaver, there are several choices for ASP creation: ASP JavaScript: run at client side?? ASP VBScript: run at server side?? ASP.NET C# ASP.NET VB I don't understand the differences between ASP JavaScript and ASP VBScript?? Because JavaScript is client-side technology, and ASP is server side technology. I think VBScript is used to implement ASP pages.
29
6009
by: Christopher Brandsdal | last post by:
If I have a .ASP page that runs JScript code - is it possible to include an ..ASP page that runs VBscript???
20
5960
by: Harag | last post by:
Hi All. I'm stating out doing some web developing. I was wondering which of the server side languages should I concentrate on and learn. I Know CSS, HTML, T-SQL I can look at the client javascript code and work out what it does but I can't really write it from scratch.
16
9339
by: Mike Schinkel | last post by:
Does anyone know if there are bugs in VBScript's GetRef()? I'm using VBScript Version 5.6.8515 on Win2003Server w/ASP. Sometimes it returns an object that VarType() says is a vbObject. Other times it returns VarType() is vbEmpty. This is driving me mad! Also, does anyone know what the properties and methods are for the object returned by GetRef()? TIA.
5
5189
by: gpence | last post by:
!!! Newbie question warning !!! I am somewhat familiar with javascript's ability to "access" the browser's favorites list -- for example, using window.home() will take you to the default URL -- is there any similar code for an ASP page using VBscript? I want my Logout button to take them back to their homepage. I've looked into Response.Redirect, but I can't seem to find a way to take the user out of my program to their home default. ...
4
12669
by: chris.dunigan | last post by:
I'm looking for an example of how to execute an existing DTS­ package from an ASP (VB)script and would appreciate any and all response. ­I don't even know if it's possible Thanks - Chuck Gatto Dan Guzman Apr 27 2000, 12:00 am show options
2
2847
by: Frank | last post by:
Can I do this? I add a session var in C# and ultimatly want to pass it into a vbscript client side activeX control. This is what I have so far but get " Object Required:'name2' " error. Can anyone suggest a btter way of passing a session var into a vbscript function? <%@ Page language="c#" debug="true" ContentType="text/html"
7
13435
by: skeddy | last post by:
In a nutshell, I'm trying to dynamically create a select box with ResultSet code in vbscript and then need to be able to access the value of that select box later with a Save button. I've got the select box filling with code similar to below: <SCRIPT LANGUAGE=VBSCRIPT RUNAT=SERVER> Public Sub BuildComboBox(rs, dispname, val, name, selected) 'rs = the recordset 'val = fieldname to place in the val of the option
10
4693
by: Shadow Lynx | last post by:
That subject packs a whallop, so let me explain in better detail what's happening and how it relates to ASPX pages... In a nutshell, if the first <script /on a page is of type "text/vbscript", you cannot use inline JavaScript statements that call setTimeout with functions that start with a double-underscore. This is very relavant to ASPX (ASP Dot Net) pages because it means that AutoPostBacks will fail since they generally call the...
6
1947
by: rishabhshrivastava | last post by:
Hello All, I am using ASP.NET 2.0 and I am experiencing a problem using vbscript that is this script on client side is preventing the postback of my controls. I have a dropdownlist which is supposed to perform some fucntion when the selected index is changed, it works fine without vbscript code(when i comment out that code) but when I uncomment the code the postback dosen't happen.
0
8175
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8625
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8482
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7168
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6111
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5565
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2610
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1487
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.