473,406 Members | 2,843 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

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="VBSCRIPT"><![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:stylesheet 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 3028
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********@hotmail.com> wrote in message
news:b3**************************@posting.google.c om...
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="VBSCRIPT"><![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:stylesheet 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********@hotmail.com> wrote in message
news:b3**************************@posting.google.c om...
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="VBSCRIPT"><![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:stylesheet 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.loadXML method instead of the DOMDocument.load 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.ServerVariables("LOGON_USER"))
iPos = Len(strNTUser) - InStr(1, strNTUser, "\", 1)
strNTUser = Right(strNTUser, iPos)
strSQLUser = Replace(strNTUser,"_"," ")
strSQLUser=UCase(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"),server.MapPath("test.xs l")

loadXMLFile SXML,server.MapPath("test.xsl")
Function loadXMLFile(strXMLFile, strXSLFile)

'Declare local variables
Dim objXML
Dim objXSL
'Instantiate the XMLDOM Object that will hold the XML file.
set objXML = Server.CreateObject("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.CreateObject("Microsoft.XMLDOM")

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

'Load the XSL file.
objXSL.load(strXSLFile)
'Use the "transformNode" method of the XMLDOM to apply the
'XSL stylesheet to the XML document. Then the output is
'written to the client.
Response.Write(objXML.transformNode(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
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...
29
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
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...
16
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...
5
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 --...
4
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...
2
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...
7
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...
10
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",...
6
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
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,...
0
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...

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.