[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Future XSLT extensions. document(). Summary.

Subject: Re: Future XSLT extensions. document(). Summary.
From: "Steve Muench" <smuench@xxxxxxxxxxxxx>
Date: Wed, 22 Mar 2000 11:38:09 -0800
oracle xslt document
| > Any listbox that needs to be filled is  filled using the document() function to 
| > get that list from the database.
| 
| Are you saying that XSLT has a standard way of "getting list from the 
| database" ?

Sure.

The document() function allows any XML resource reachable
via a URI to be brought into the XSLT processing. Several
technologies are available to make dynamic database
content easily "reachable via HTTP URL" as XML resources.

| Very interesting.  Could you please tell me what is the syntax 
| of XSLT document() you are using to access the database?

Here's an example that uses document() to retrieve the <Code>
and <Description> of any airports in the world matching
the value of the "code" parameter passed into the stylesheet.

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output indent="yes"/>
<xsl:param name="code"/>
<xsl:template match="/">
<Airports xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xsl:version="1.0">
  <xsl:variable name="baseUrl"
    select="'http://ws5.olab.com/xsql/demo/airport/airport.xsql?airport='"/>
  <xsl:variable name="dataServiceUrl" select="concat($baseUrl,$code)"/>
  <xsl:variable name="dynamicAirportList" select="document($dataServiceUrl)"/>
  <xsl:for-each select="$dynamicAirportList">
    <xsl:copy-of select="//Airport/Code | //Airport/Description"  </xsl:for-each>
</Airports>
</xsl:template>
</xsl:stylesheet>

$ oraxsl -p code='xml' any.xml airports.xsl

Returns:

<?xml version = '1.0' encoding = 'UTF-8'?>
<Airports>
   <Code>XML</Code>
   <Description>Minlaton, Sa, Australia</Description>
</Airports>

$ xt any.xml airports.xsl code='paul'

Returns:

<?xml version = '1.0' encoding = 'UTF-8'?>
<Airports>
   <Code>CGH</Code>
   <Description>Sao Paulo, Sp, Brazil-Congonha</Description>
   <Code>GRU</Code>
   <Description>Sao Paulo, Sp, Brazil-Guarulho</Description>
   <Code>KPH</Code>
   <Description>Pauloff Harbor, Alaska, Usa</Description>
   <Code>MSP</Code>
   <Description>Minneapolis/St. Paul-Intl</Description>
   <Code>PAV</Code>
   <Description>Paulo Afonso, Ba, Brazil</Description>
   <Code>SAO</Code>
   <Description>Sao Paulo, Sp, Brazil-Guarulho</Description>
   <Code>SNP</Code>
   <Description>St. Paul Island, Alaska, Usa</Description>
   <Code>STP</Code>
   <Description>Minneapolis/St. Paul-Dntn</Description>
   <Code>SVM</Code>
   <Description>St. Paul'S Mission, Qld, Austr</Description>
   <Code>SVV</Code>
   <Description>San Salvador De Paul, Venezuel</Description>
</Airports>

On the server side, sitting out on the Internet is an Oracle XSQL Page
at the URL: http://ws5.olab.com/xsql/demo/airport/airport.xsql
and an Oracle database with a table of all airports in the world.

Which looks like this:

<?xml version="1.0"?>
<xsql:query xmlns:xsql="urn:oracle-xsql"
     connection="demo" 
     rowset-element="Ok" 
     max-rows="1" 
     row-element="Airport" >

       SELECT tla "Code", description "Description"
  FROM AIRPORT
 WHERE tla = UPPER('{@airport}')

  <xsql:no-rows-query 
     max-rows="10" 
     rowset-element="Error" 
     row-element="Airport" >

       SELECT tla "Code", description "Description"
  FROM AIRPORT
 WHERE UPPER(description) LIKE UPPER('%{@airport}%')
        ORDER BY tla
  </xsql:no-rows-query>

</xsql:query>

_________________________________________________________
Steve Muench, Consulting Product Manager & XML Evangelist
Business Components for Java Development Team

 
| > Any listbox that needs to be filled is  filled using the document() function to 
| > get that list from the database.
| 
| Are you saying that XSLT has a standard way of "getting list from the 
| database" ?
| 
| Very interesting.  Could you please tell me what is the syntax 
| of XSLT document() you are using to access the database?
| 
| Would it work in more than one environment? If it will work 
| only in particular environment isn't it just a vendor-specific
| extension? 
| 
| > Without the document() function, XSLT is extremely limited.
| 
| Is that possible to get some examples of using document() 
| in the form other than document(URI) then ?  ( Once again, 
| nobody is saying that document(URI) should die. 
| But document() is much more than just document(URI) ).
| 
| Rgds.Paul.
| 
| 
| 
|  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
| 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.