DxpHome ||
Samples ||
Details ||
Docs ||
Trees ||
xml-xsl ||
Links
Source for recordset.dxp
<?xml version="1.0"?> <!-- notice that contentType is text/xml -->
<dxp:DxpPage xmlns:dxp="dxp.plands.com" contentType="text/xml" buffsize="4096" debug="false">
<!-- specify stylesheet for client. CDATA tells our server parser to ignore it -->
<![CDATA[ <?xml-stylesheet type="text/xsl" href="http://dxp.plands.com/sample-xml/style/recordset.xsl" ?> ]]>
<dxp:DbStmt action="query" dbcon="datauser" store="result">
<dxp:Cp name="sql">Select username, beverage, cost from userpref</dxp:Cp>
</dxp:DbStmt>
<doc>
<recordset>
<labels>
<label>User</label><label>Beverage</label><label>Cost</label>
</labels>
<dxp:LoopSet matrix="result">
<row>
<col><dxp:Index value="0"/></col><col><dxp:Index value="1"/></col><col><dxp:Index value="2"/></col>
</row>
</dxp:LoopSet>
</recordset>
<info>
<item>
The xml data for this page came from recordset.dxp using the same dxp tags you would use
to send html output. The contentType attribute in the DxpPage (top node) was set to text/xml
rather than text/html and a stylesheet was specified.
</item>
<item>
If the client browser can do XSL processing the stylesheet is downloaded by the client
and used to format the xml data for display. Doing this on the server would be expensive
because a DOM object must be created for each request and the stylesheet must be applied
to each DOM to produce the final output for that request.
</item>
<item>
An xml aware browser has to create a DOM object anyway, even for html, so it makes sense
to apply the stylesheet on the client rather than the server.
</item>
</info>
</doc>
</dxp:DxpPage>
|