1 / 5

Using XSLT with Web Services

Using XSLT with Web Services. Roger L. Costello XML Technologies. Document() function is for more than just static XML documents!. The format of the document function is: document(url). The URL does not have to be to a static XML document. It can be to any URL which serves up XML.

tyme
Download Presentation

Using XSLT with Web Services

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Using XSLT with Web Services Roger L. Costello XML Technologies

  2. Document() function is for more than just static XML documents! • The format of the document function is: document(url). The URL does not have to be to a static XML document. It can be to any URL which serves up XML. • In other words, the URL could be to a Web service which dynamically generates XML documents!

  3. XSLT as a Data Aggregator Web Service 2 Web Service 1 document(url2) document(url1) XSLT

  4. Meerkat Web Service • Meerkat is an open service[1] which aggregates data from hundreds of sites • Here's an example of how to retrieve an XML document of all articles that were written on REST in the last 14 days: • http://meerkat.oreillynet.com/?_fl=xml&s=REST&t=14DAY • Here are highlights of the Meerkat API[2] • _fl is used to indicate the desired "flavor" of the result. Legal values: xml, RSS 1.0, RSS 0.9, Minimal, Tokeerkat, Meerkat • s is used to specify what you want Meerkat to search for. Separate keywords with a plus, e.g., REST+SOAP means you want all articles with REST or SOAP in them • t is used to specify how far back you want Meerkat to look for stories. You give it a number and then either MINUTE, HOUR, DAY, ALL. ALL means that you want all stories (no number needed with ALL) [1] An open service is a web service that is free and has a publicly available API [2] See this URL for the complete Meerkat API: http://www.oreillynet.com/lpt/a//rss/2000/05/09/meerkat_api.html

  5. <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="html"/> <xsl:template match="/"> <HTML> <BODY> <xsl:variable name="Meerkat" select="document('http://www.oreillynet.com/meerkat/?_fl=xml&amp;s=REST')"/> <TABLE border="1" width="75%"> <TR> <TH>Title</TH> <TH>Description</TH> </TR> <xsl:for-each select="$Meerkat/meerkat/story"> <TR> <TD><xsl:value-of select="title"/></TD> <TD><xsl:value-of select="description"/></TD> </TR> </xsl:for-each> </TABLE> </BODY> </HTML> </xsl:template> </xsl:stylesheet> See document-example01 [Note: if you are running the stylesheet behind a firewall you will need to set the HTTP_PROXY appropriately.]

More Related