Does your uri work? I tried it and got nothing, but you could be on an intranet.

http://raptor.mtc.ti.com:9081/rtdui/WebUI?action=getStationStatus

Whats your underlying JAXP transformer implementation? From my experience I believe both Saxon and Xalan support http url resolution within the document() function. This should work, I do it currently in our project using Tomcat 4.1, jstl 1.1 and Saxon 6.5.3.

JAXP does support the ability include a "URLResolver" which the document() function uses when doing resolution. My concern is that JSTL may attempt to place its own URLResolver in place...This would overide any default resolution behavior of the underlying implementation.

-Mark

Kris Schneider wrote:

The type of the scoped varible named by the "var" attribute of <c:import> is
String. Since String is also an acceptable type for both the "doc" and "xslt"
attributes of <x:transform>, you should be able to do:

<c:import var="doc" url="uiConfig.xml"/>
<c:import var="xslt" url="station_list.xsl"/>
<x:transform doc="${doc}" xslt="${xslt}"/>

As for the HTTP error, the handling of the URI passed to the document function
is under the control of the XSLT processor. In fact, the XSLT spec says, "An
XSLT processor is not required to support any particular URI schemes."
Although, in practice, http is a pretty likely candidate for support. Even if
it is supported, it's up to the XSLT processor implementation to handle the
generation of the http request, which may or may not play nicely with your
middleware setup. Hence, my attempt at an alternate approach. Can you provide a
snippet from your stylesheet where you're using the document function?

If it's still of any help, here's what it looks like my example would be with
your setup (assuming the "WebUI" servlet is part of the same app):

<c:import var="statusDoc" url="/WebUI">
   <c:param name="action" value="getStationStatus"/>
</c:import>
<x:parse doc="${statusDoc}" varDom="parsedStatus"/>

<c:import var="doc" url="uiConfig.xml"/>
<c:import var="xslt" url="station_list.xsl"/>

<x:transform doc="${doc}" xslt="${xslt}">
   <x:param name="stationStatus" value="${parsedStatus}"/>
</x:transform>

Quoting "Johnson, Chris" <[EMAIL PROTECTED]>:



Still nothing.  But, the error message did change (see below).  It now
has the station_list file as the file containing the offending url.
Before it was some crazy file that doesn't exist.  But, I'm still
getting the same error.  Is it possible that it can't get output from a
servlet (in the same context anyway)?  If I call the url in a brower, it
works fine, so I know the url is valid, and there's valid xml being
returned.

jstl:station_list.xsl; Line #9; Column #124; Can not load requested doc:
Server returned HTTP response code: 500 for URL:
http://raptor.mtc.ti.com:9081/rtdui/WebUI?action=getStationStatus

-----Original Message-----
From: Mark R. Diggory [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 07, 2004 12:52 PM
To: Tag Libraries Users List
Subject: Re: XSLT question



Try just:


<c:import url="uiConfig.xml" var="config"/>
<x:parse var="xml" doc="${config}"/>
<c:import url="station_list.xsl" var="stylesheet"/> <x:transform
doc="${xml}" xslt="${stylesheet}" xsltSystemId="station_list.xsl"/>

I speculate that the c:import stores the content in a byte[] or pulls it
as an InputStream, creating a jaxp StreamSource for the template, the
problem is that the systemId gets lost in the process, for me its just a
workaround to stick it back into the JAXP transformers template Source
object. I really think JSTL is poorly mapped to JAXP, I believe one
should just be able to do

<x:transform doc="doc.xml" xslt="style.xml"/>

without all the importing crap...

-Mark


Johnson, Chris wrote:




I guess I don't understand what the xlstSystemId needs to be set to.

Here's my code as it is now:

<c:import url="uiConfig.xml" var="config"/>
<x:parse var="xml" doc="${config}"/>
<c:import url="station_list.xsl" var="stylesheet"/> <x:transform doc="${xml}" xslt="${stylesheet}"/>


Inside this transform, I want to access something like: http://host.name.com:port/context/servlet?param=value

I'm running tomcat 5.0.19 and JSTL 1.1

-----Original Message-----
From: Mark R. Diggory [mailto:[EMAIL PROTECTED]
Sent: Wednesday, April 07, 2004 12:29 PM
To: Tag Libraries Users List
Subject: Re: XSLT question


Johnson, Chris wrote:






I guess what I really want is an answer as to why document() isn't
working as it seems it should.






Mostly, I think the unexpected behavior has to do with the standard
implementations masking of underlying absolute paths to be relative to the webapplication instead of the filesystem. For example, if your webapp was installed in /usr/share/tomcat4/webapps/blaa


/foo/bar actually maps to /usr/share/tomcat4/webapps/blaa/foo/bar.





Besides, I'm already doing a transform on one document, so I don't
understand how doing this second transform on this other "document" (servlet call) would be able to be used in the first transform.


That's










why I was using document(), so I could read in another xml doc while
doing a transform. I'm using the 2nd doc to do some conditional stuff


in the first transform.






I do it now, but I'm working on tomcat4.1 and jstl 1.1





But since I had nowhere to go but up, I did part of what Kris said. I
tried doing an import of the doc, which worked, but I put the output (after parsing) into an x:param associated with the original (only) transform. But that doesn't seem to work.







It wouldn't really because most transformers use a different object tree

than DOM which the x:parse is producing.





If I do a 2nd transform on the 2nd doc, how do I reference that in the
first transform?





Did you try adding the xlstSystemId? this sets the systemId of the xslt
and allows the document function to do relative resolution from the systemId, thats just straight xslt spec/JAXP behavior. I'm using it in


jstl 1.1 because of this very issue.

What version of JSTL/standard.jar are you working with, which version of

Tomcat?





-----Original Message-----
From: Mark R. Diggory [mailto:[EMAIL PROTECTED]
Sent: Wednesday, April 07, 2004 12:04 PM
To: Tag Libraries Users List
Subject: Re: XSLT question


Try setting the systemId for the stylesheet, this may help configure the

proper resolution.

         <c:import var="xslt" scope="request" url='${url}'/>
         <x:transform xml="${xml}" xslt="${xslt}"
xsltSystemId="${url}"> -Mark

Kris Schneider wrote:







As an alternative, perhaps you can use an XSLT parameter to hold the servlet
output:


<c:import url="/xmlServlet" var="servletXml"/>
<x:parse xml="${servletXml}" var="servletDoc"/>
<x:transform xml="${xml}" xslt="${xslt}">
<x:param name="dynamicXml" value="${servletDoc}"/> </x:transform>

Where your stylesheet would include an <xsl:param> element:

<xsl:param name="dynamicXml"/>

Haven't tried this with a full-blown document as a parameter before...

Quoting "Johnson, Chris" <[EMAIL PROTECTED]>:









I'm having trouble using the XSLT document() function.

What I need to do is to call a servlet which will send back some dynamic xml that I need to reference in my XSLT template.

I've tried using various relative paths, and the full (http://...) path with no luck. When I use the full path, I get this error in the








catalina.out file: Can not load requested doc: Server returned HTTP
response code: 500 for
URL: http:...  I've made sure there are no typos in the url.

When using a relative path, the error suggests that document() is looking for the resource as a file on the server.

I've looked around on the web and see people supposedly using
document() with full paths, but nothing describing the problem I'm
having.

Any help would be greatly appreciated.

Thanks,
Chris








--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to