473,537 Members | 2,832 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XSLT document() problems

Sorry for posting to a lot of groups, but I'm not sure what this
problem relates to, so I thought it was better to be safe than
sorry. Please feel free to set FUT to the proper group when
answering.

I'm having problems with the XSLT function 'document()' after
upgrading to ASP.NET 1.1. I've started using XmlUrlResolver in
the xslt.Transform() method, but it doesn't seem to help in all
cases.

What I use the 'document()' function for, is requesting a
WebService which returns a string. This is how I do it, which
worked in ASP.NET 1.0:

<xsl:variable name="wsLenkeUrl"
select="concat('/D3/WebSvc/Lenke.asmx/HentLenkeUri?
artikkelid=', $artikkelId, '&amp;lenkeid=', $lenkeId)" />

<xsl:variable name="url"
select="document($wsLenkeUrl)/lnk:string" />

The '$url' variable should now contain a URL which is returned
from the webservice. The 'lnk' namespace is declared as the same
used in the return from the WebService. I've also tried using a
static and non-relative path for the '$wsLenkeUrl' (with
"http://...", but it doesn't help.

What's strange, is that if I do the 'document()' function on a
static XML document, it works. I can include (with <xsl:copy-
of>) static XML documents in the same XSLT stylesheet, in the
exact same transformation, but when I do 'document()' on
relative documents as a WebsSrvice, it doesn't work.

What I'm thinking is that doing requests to a WebService might
require some higher permissions than doing so to a static
document. Maybe a QueryString is only permitted when the
permission have been skewed up from the normal permissions, but
I haven't read about this anywhere, and I don't know how to do
it.

Could you please provide me with some information on how to do a
request to a WebService with the 'document()' function in XSLT,
when transformed in an ASP.NET 1.1 WebForm? Many thanks in
advance.

--
Asbjørn Ulsberg -=|=- X-No-Archive: No
"He's a loathsome offensive brute, yet I can't look away"
Nov 11 '05 #1
4 4800
Asbjørn Ulsberg wrote:
The '$url' variable should now contain a URL which is returned
from the webservice. The 'lnk' namespace is declared as the same
used in the return from the WebService. I've also tried using a
static and non-relative path for the '$wsLenkeUrl' (with
"http://...", but it doesn't help.

What's strange, is that if I do the 'document()' function on a
static XML document, it works. I can include (with <xsl:copy-
of>) static XML documents in the same XSLT stylesheet, in the
exact same transformation, but when I do 'document()' on
relative documents as a WebsSrvice, it doesn't work.

Chances are it has something to do with a way you are loading XslTransform
object. E.g. if you are loading it from a string, then of course relative
URI's in document() cannot be resolved relatively to Base URI of the stylesheet.
Show us your code.
--
Oleg Tkachenko
http://www.tkachenko.com/blog
Multiconn Technologies, Israel

Nov 11 '05 #2
"Oleg Tkachenko" skrev:
Chances are it has something to do with a way you are loading
XslTransform object. E.g. if you are loading it from a string,
then of course relative URI's in document() cannot be resolved
relatively to Base URI of the stylesheet.
If I load the XSLT document from a string that has an absolute
URL, shouldn't it work?
Show us your code.


Ok, this is how I do it:

StringWriter sw = new StringWriter();
XslTransform xsl = new XslTransform();

string file = "http://" + HttpContext.Current.Request.Url.Host
+ HttpContext.Current.Request.ApplicationPath +
"/ressurser/xslt/" + xslfile; // "xslfile" is e.g. "tr.xslt"

// "file" will contain the absolute path to the XSLT
// stylesheet document.

xsl.Load(file);
xsl.Transform(dok, null, sw, new XmlUrlResolver());

return sw.ToSTring();

--
Asbjørn Ulsberg -=|=- X-No-Archive: No
"He's a loathsome offensive brute, yet I can't look away"
Nov 11 '05 #3
Asbjørn Ulsberg wrote:
If I load the XSLT document from a string that has an absolute
URL, shouldn't it work?

That means you are loading XSLT document from URL, not from string.
Should work.

Another idea - are you sure your web service supports HTTP GET requests? Try
to open the url in a browser to see what is returned.
--
Oleg Tkachenko
http://www.tkachenko.com/blog
Multiconn Technologies, Israel

Nov 11 '05 #4
"Oleg Tkachenko" skrev:
If I load the XSLT document from a string that has an
absolute URL, shouldn't it work?
That means you are loading XSLT document from URL, not from
string. Should work.


Of course. I just thought «string url = "http://...";» at first,
but now that you explain it, I understand what you initially
meant. #:p
Another idea - are you sure your web service supports HTTP
GET requests?


Yup. I do a little <xsl:value-of select="$url" /> in the XSLT
document, and when I do a HTTP GET on that in a browser, it
returns the correct result.

--
Asbjørn Ulsberg -=|=- X-No-Archive: No
"He's a loathsome offensive brute, yet I can't look away"
Nov 11 '05 #5

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

Similar topics

0
2682
by: Sergio del Amo | last post by:
Hi, I use the xslt functions provided by php. I am running in my computer the package xampp(www.apachefriends.org) which includes php/apache/mysql .. In this package the php includes the sablotron extension responsible for the xslt functions. The problem i have is that the obtained transformation is not the waited one. I try to proccess the...
5
2043
by: Don Garrett | last post by:
I have an XML document at the root of a directory tree that contains relative URIs to resources in a directory tree. During XSLT processing, these URI's can be used without any problems to access the various documents in the tree. However, when generating HTML output, the output <a href=""> tags need to be adjusted for the location of the...
2
7061
by: Dave Matthews | last post by:
Hi folks, I'm writing a web-page editing tool for my company which will allow staff (with no "technical" expertise) to maintain their own Intranet sites. The content for each webpage is stored in the form of XHTML in an XML document (which, in turn, is stored in an XML database). So far so good. However the editing tool must allow users to...
4
2108
by: Ringo Langly | last post by:
Hi all, I'm a seasoned web programmer, but I've never touched XSLT. It's always been one of those acronyms I've never needed to educate myself on. Now... we're working with a web content provider who says we need to use XSLT and Web Services to pull the content from their site. Can someone give me a nutshell definition on how this...
12
3386
by: Keith Chadwick | last post by:
I have a fairly hefty XSLT file that for the sake of debugging and clarity I wish to split into some separate sub-templates contained within the same file. The master template calls an apply-templates and passes a node set to it. This template in turn defines approximately 15 variables that dictate how the following template should proceed....
2
1633
by: Pawel | last post by:
I have small problem with XslTransformation. I get from WebService xml document. I have xslt and I want transform xml document to html code. It's look easy but I cant't manage with xPath. Maybe someone help me with that. I have problems with xPath in xslt file. I can't navigate by names only by vertical and horizontal axis. What's wrong .......
4
1308
by: Asbjørn Ulsberg | last post by:
Sorry for posting to a lot of groups, but I'm not sure what this problem relates to, so I thought it was better to be safe than sorry. Please feel free to set FUT to the proper group when answering. I'm having problems with the XSLT function 'document()' after upgrading to ASP.NET 1.1. I've started using XmlUrlResolver in the...
12
11557
by: Chris | last post by:
Hi, Just wondering if anyone out there knows if it is possible to convert a CSV to xml using XSLT? I've seen a lot of examples of xml to CSV, but is it possible to go back the other way? I don't want to have to use some external program or script to parse the csv first if possible
0
7361
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7298
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...
0
7531
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7683
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...
1
7275
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7642
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...
0
5824
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...
0
4844
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...
1
924
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.