Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > XSLT document() problems

Reply
Thread Tools

XSLT document() problems

 
 
Asbjørn Ulsberg
Guest
Posts: n/a
 
      09-24-2003
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"
 
Reply With Quote
 
 
 
 
Asbjørn Ulsberg
Guest
Posts: n/a
 
      09-24-2003
"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"
 
Reply With Quote
 
 
 
 
Oleg Tkachenko
Guest
Posts: n/a
 
      09-24-2003
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

 
Reply With Quote
 
Oleg Tkachenko
Guest
Posts: n/a
 
      09-24-2003
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

 
Reply With Quote
 
Asbjørn Ulsberg
Guest
Posts: n/a
 
      09-24-2003
"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. #

> 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"
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Including XSLT/XML document within a XSLT document dar_imiro@hotmail.com XML 4 12-13-2005 02:26 AM
Multiple XSLT Transforms using a Controller XSLT sneill@mxlogic.com XML 2 10-19-2005 11:00 AM
ANN: New low-cost XML Editor, XSLT Editor, XSLT Debugger, DTD/Schema Editor Stylus Studio Java 0 08-03-2004 03:53 PM
xslt alone or xslt/java for static site? ted XML 1 01-26-2004 10:41 AM
[XSLT]Passing values from Javascript to a XSLT variable Benjamin Hillsley XML 3 09-25-2003 04:50 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57