Multiple XML documents in one XSL file as variables

P

platinumplus000

Does any XSLT expert know if there is a way to import xml data as a
parameter into an XSL stylesheet. I know you can import an XML file
using the document('file.xml') function but the data I get comes from a
web service and I would rather not write it to a file and then delete
after the transformation if I don't have to.

I found this example but it did not work for me:
http://www.zend.com/tips/tips.php?id=253&single=1

And I searched around and couldn't find any more examples of this.

-Derrick
 
M

Martin Honnen

Does any XSLT expert know if there is a way to import xml data as a
parameter into an XSL stylesheet. I know you can import an XML file
using the document('file.xml') function but the data I get comes from a
web service and I would rather not write it to a file and then delete
after the transformation if I don't have to.

Well the document function load from a URI and not necessarily a static
file so I don't see any problem, if that web service exposes its service
with a HTTP URI then simply use e.g.
document('http://example.com/service?arg1=1&arg2=2')
and the XSLT processor will access the web service as needed.
 
R

Richard Tobin

Martin Honnen said:
Well the document function load from a URI and not necessarily a static
file so I don't see any problem, if that web service exposes its service
with a HTTP URI

So long as it works with GET rather than POST.

-- Richard
 
P

platinumplus000

Thanks using a HTTP URI works. I probably won't link directly to the
web service, instead I'll point to local a php page that'll serve up
the XML after doing some preprocessing.

I guess my assumption was right that there isn't a way to pass in XML
data as a parameter.

Thanks
 
D

Dimitre Novatchev

I guess my assumption was right that there isn't a way to pass in XML
data as a parameter.

Of course, such assumption is wrong. Every XSLT processor has
(implementation-dependent) ways of passing external parameters to the
transformation.

Just read the respective documentation.

Cheers,
Dimitre Novatchev

Thanks using a HTTP URI works. I probably won't link directly to the
web service, instead I'll point to local a php page that'll serve up
the XML after doing some preprocessing.

I guess my assumption was right that there isn't a way to pass in XML
data as a parameter.

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top