<html><head><link rel=StyleSheet href='api-content.css' TYPE='text/css' MEDIA='screen'><title>.Usage</title> <script> function navToEntry(entry) { window.location.href='api-' + entry + '.html'; } function navToGroup(group) { var f = parent.frames['toc-container']; if (!f) window.open ('sparse-toc.html#' + group, 'toc_container'); else { if (f.location.href.search('abc') != -1) f.location.href = 'sparse-toc.html#' + group; else f.location.hash = group; } } </script> </head><body bgcolor='white'> <!-- -- HEADS UP! This page was *GENERATED* by APIDOC, -- DO NOT EDIT THIS FILE BY HAND! -- See http://www.mozilla.org/projects/apidoc for information on APIDOC -- The original source file was sablot.xml --> <h1 class='title'>Sablotron Guide and Reference</h1> <center><table class='api-entry' width='100%' cellspacing='0'border='1' cellpadding='10'> <tr><td class='entry-heading'> <table class='entry-heading-table' width='100%' cellpadding='5'cellspacing='0'><tr> <td class='entry-title' valign='center'><font size='+5'>Usage</font></td> <td class='entry-type' align='center' width='25%'>.General</td> </tr></table> </td></tr> <tr><td class='entry-summary'> <h4 class='entry-subhead'>Summary</h4> Examples of how to use the native API of Sablotron. </td></tr> <tr><td class='entry-syntax'> <h4 class='entry-subhead'>Syntax</h4><pre> EXAMPLE 1: a simple transformation SablotSituation S; SablotHandle proc; SablotCreateSituation(&S); SablotCreateProcessorForSituation(S, &proc); SablotRunProcessorGen(S, proc, "my_sheet.xsl", "my_data.xml", "arg:/out"); char * result; SablotGetResultArg(proc, "arg:/out", &result); ... SablotFree(result); SablotDestroyProcessor(proc); SablotDestroySituation(S); EXAMPLE 2: a transformation with reusable parsed trees SablotSituation S; SablotHandle proc; SDOM_Document xsl, xml; SablotCreateSituation(&S); SablotParseStylesheetBuffer(S, my_xsl_ptr, &xsl); SablotParseBuffer(S, my_xml_ptr, &xml); SablotCreateProcessorForSituation(S, &proc); SablotAddArgTree(S, proc, "sheet", xsl); SablotAddArgTree(S, proc, "data", xml); SablotRunProcessorGen(S, proc, "arg:/sheet", "arg:/data", "arg:/out"); char * result; SablotGetResultArg(proc, "arg:/out", &result); ... SablotFree(result); SablotDestroyDocument(xsl); SablotDestroyDocument(xml); SablotDestroyProcessor(proc); SablotDestroySituation(S); </pre> </td></tr> <tr><td class='entry-description'> <h4 class='entry-subhead'>Description</h4> The first example shows the simplest way to run a transformation with two files. The second example parses trees explicitly and makes them available for further processing. In this example, the source XML document and the XSLT stylesheet are already loaded in strings (my_xsl_ptr, my_xml_ptr). To work with URIs, use <code><a href='javascript:navToEntry("SablotParseStylesheet");'>SablotParseStylesheet</a></code> and <code><a href='javascript:navToEntry("SablotParse");'>SablotParse</a></code> instead of <code><a href='javascript:navToEntry("SablotParseStylesheetBuffer");'>SablotParseStylesheetBuffer</a></code> and <code><a href='javascript:navToEntry("SablotParseBuffer");'>SablotParseBuffer</a></code>. </td></tr> <tr><td class='entry-seealso'> <h4 class='entry-subhead'>See Also</h4> <table class='seealso-table'> <tr class='seealso-groups'><td>Groups</td> <td>[ <a href='javascript:navToGroup("GROUP_.General")'>.General</a> ]</td></tr> <tr class='seealso-internals'><td>Entries</td> <td>[ <a href='javascript:navToEntry("SablotParse");'>SablotParse</a> | <a href='javascript:navToEntry("SablotParseBuffer");'>SablotParseBuffer</a> | <a href='javascript:navToEntry("SablotParseStylesheet");'>SablotParseStylesheet</a> | <a href='javascript:navToEntry("SablotParseStylesheetBuffer");'>SablotParseStylesheetBuffer</a> ]</td></tr> </table> </td></tr> </table></center><br> © 2002-2003 Ginger Alliance<BR><i>revision 03-06-30</i><BR> <center>This page was generated by <a href='http://www.mozilla.org/projects/apidoc' target='other_window'><b>APIDOC</b></a></center> </body></html>