| <HTML><HEAD><SCRIPT language="JavaScript" src="resources/script.js" type="text/javascript"></SCRIPT><TITLE>Xalan-C++ Samples</TITLE></HEAD><BODY alink="#ff0000" bgcolor="#ffffff" leftmargin="4" link="#0000ff" marginheight="4" marginwidth="4" text="#000000" topmargin="4" vlink="#0000aa"><TABLE border="0" cellpadding="0" cellspacing="0" width="620"><TR><TD align="left" height="60" rowspan="3" valign="top" width="135"><IMG alt="logo" border="0" height="60" hspace="0" src="resources/logo.gif" vspace="0" width="135"></TD><TD align="left" colspan="4" height="5" valign="top" width="456"><IMG alt="line" border="0" height="5" hspace="0" src="resources/line.gif" vspace="0" width="456"></TD><TD align="left" height="60" rowspan="3" valign="top" width="29"><IMG alt="right" border="0" height="60" hspace="0" src="resources/right.gif" vspace="0" width="29"></TD></TR><TR><TD align="left" bgcolor="#0086b2" colspan="4" height="35" valign="top" width="456"><IMG alt="" border="0" height="35" hspace="0" src="graphics/samples-header.jpg" vspace="0" width="456"></TD></TR><TR><TD align="left" height="20" valign="top" width="168"><IMG alt="bottom" border="0" height="20" hspace="0" src="resources/bottom.gif" vspace="0" width="168"></TD><TD align="left" height="20" valign="top" width="96"><A href="http://xalan.apache.org/" onMouseOut="rolloverOff('xml');" onMouseOver="rolloverOn('xml');" target="new"><IMG alt="http://xalan.apache.org/" border="0" height="20" hspace="0" name="xml" onLoad="rolloverLoad('xml','resources/button-xml-hi.gif','resources/button-xml-lo.gif');" src="resources/button-xml-lo.gif" vspace="0" width="96"></A></TD><TD align="left" height="20" valign="top" width="96"><A href="http://www.apache.org/" onMouseOut="rolloverOff('asf');" onMouseOver="rolloverOn('asf');" target="new"><IMG alt="http://www.apache.org/" border="0" height="20" hspace="0" name="asf" onLoad="rolloverLoad('asf','resources/button-asf-hi.gif','resources/button-asf-lo.gif');" src="resources/button-asf-lo.gif" vspace="0" width="96"></A></TD><TD align="left" height="20" valign="top" width="96"><A href="http://www.w3.org/" onMouseOut="rolloverOff('w3c');" onMouseOver="rolloverOn('w3c');" target="new"><IMG alt="http://www.w3.org/" border="0" height="20" hspace="0" name="w3c" onLoad="rolloverLoad('w3c','resources/button-w3c-hi.gif','resources/button-w3c-lo.gif');" src="resources/button-w3c-lo.gif" vspace="0" width="96"></A></TD></TR></TABLE><TABLE border="0" cellpadding="0" cellspacing="0" width="620"><TR><TD align="left" valign="top" width="120"><IMG alt="join" border="0" height="14" hspace="0" src="resources/join.gif" vspace="0" width="120"><BR> |
| |
| |
| |
| <A href="index.html" onMouseOut="rolloverOff('side-index');" onMouseOver="rolloverOn('side-index');"><IMG alt="Xalan-C++ 1.10" border="0" height="12" hspace="0" name="side-index" onLoad="rolloverLoad('side-index','graphics/index-label-2.jpg','graphics/index-label-3.jpg');" src="graphics/index-label-3.jpg" vspace="0" width="120"></A><BR> |
| |
| <A href="overview.html" onMouseOut="rolloverOff('side-overview');" onMouseOver="rolloverOn('side-overview');"><IMG alt="Overview" border="0" height="12" hspace="0" name="side-overview" onLoad="rolloverLoad('side-overview','graphics/overview-label-2.jpg','graphics/overview-label-3.jpg');" src="graphics/overview-label-3.jpg" vspace="0" width="120"></A><BR> |
| |
| <A href="charter.html" onMouseOut="rolloverOff('side-charter');" onMouseOver="rolloverOn('side-charter');"><IMG alt="Charter" border="0" height="12" hspace="0" name="side-charter" onLoad="rolloverLoad('side-charter','graphics/charter-label-2.jpg','graphics/charter-label-3.jpg');" src="graphics/charter-label-3.jpg" vspace="0" width="120"></A><BR> |
| |
| |
| <A href="whatsnew.html" onMouseOut="rolloverOff('side-whatsnew');" onMouseOver="rolloverOn('side-whatsnew');"><IMG alt="What's New" border="0" height="12" hspace="0" name="side-whatsnew" onLoad="rolloverLoad('side-whatsnew','graphics/whatsnew-label-2.jpg','graphics/whatsnew-label-3.jpg');" src="graphics/whatsnew-label-3.jpg" vspace="0" width="120"></A><BR> |
| |
| <IMG alt="separator" border="0" height="6" hspace="0" src="resources/separator.gif" vspace="0" width="120"><BR> |
| |
| <A href="download.html" onMouseOut="rolloverOff('side-download');" onMouseOver="rolloverOn('side-download');"><IMG alt="Downloads" border="0" height="12" hspace="0" name="side-download" onLoad="rolloverLoad('side-download','graphics/download-label-2.jpg','graphics/download-label-3.jpg');" src="graphics/download-label-3.jpg" vspace="0" width="120"></A><BR> |
| |
| <A href="build_instruct.html" onMouseOut="rolloverOff('side-build_instruct');" onMouseOver="rolloverOn('side-build_instruct');"><IMG alt="Build Instructions" border="0" height="12" hspace="0" name="side-build_instruct" onLoad="rolloverLoad('side-build_instruct','graphics/build_instruct-label-2.jpg','graphics/build_instruct-label-3.jpg');" src="graphics/build_instruct-label-3.jpg" vspace="0" width="120"></A><BR> |
| |
| <A href="install.html" onMouseOut="rolloverOff('side-install');" onMouseOver="rolloverOn('side-install');"><IMG alt="Installation" border="0" height="12" hspace="0" name="side-install" onLoad="rolloverLoad('side-install','graphics/install-label-2.jpg','graphics/install-label-3.jpg');" src="graphics/install-label-3.jpg" vspace="0" width="120"></A><BR> |
| |
| <IMG alt="separator" border="0" height="6" hspace="0" src="resources/separator.gif" vspace="0" width="120"><BR> |
| |
| <IMG alt="Sample Apps" border="0" height="12" hspace="0" src="graphics/samples-label-1.jpg" vspace="0" width="120"><BR> |
| |
| <A href="commandline.html" onMouseOut="rolloverOff('side-commandline');" onMouseOver="rolloverOn('side-commandline');"><IMG alt="Command Line" border="0" height="12" hspace="0" name="side-commandline" onLoad="rolloverLoad('side-commandline','graphics/commandline-label-2.jpg','graphics/commandline-label-3.jpg');" src="graphics/commandline-label-3.jpg" vspace="0" width="120"></A><BR> |
| |
| <A href="usagepatterns.html" onMouseOut="rolloverOff('side-usagepatterns');" onMouseOver="rolloverOn('side-usagepatterns');"><IMG alt="Usage Patterns" border="0" height="12" hspace="0" name="side-usagepatterns" onLoad="rolloverLoad('side-usagepatterns','graphics/usagepatterns-label-2.jpg','graphics/usagepatterns-label-3.jpg');" src="graphics/usagepatterns-label-3.jpg" vspace="0" width="120"></A><BR> |
| |
| <IMG alt="separator" border="0" height="6" hspace="0" src="resources/separator.gif" vspace="0" width="120"><BR> |
| |
| <A href="programming.html" onMouseOut="rolloverOff('side-programming');" onMouseOver="rolloverOn('side-programming');"><IMG alt="Programming" border="0" height="12" hspace="0" name="side-programming" onLoad="rolloverLoad('side-programming','graphics/programming-label-2.jpg','graphics/programming-label-3.jpg');" src="graphics/programming-label-3.jpg" vspace="0" width="120"></A><BR> |
| |
| <A href="extensions.html" onMouseOut="rolloverOff('side-extensions');" onMouseOver="rolloverOn('side-extensions');"><IMG alt="Extensions" border="0" height="12" hspace="0" name="side-extensions" onLoad="rolloverLoad('side-extensions','graphics/extensions-label-2.jpg','graphics/extensions-label-3.jpg');" src="graphics/extensions-label-3.jpg" vspace="0" width="120"></A><BR> |
| |
| <A href="extensionslib.html" onMouseOut="rolloverOff('side-extensionslib');" onMouseOver="rolloverOn('side-extensionslib');"><IMG alt="Extensions Library" border="0" height="12" hspace="0" name="side-extensionslib" onLoad="rolloverLoad('side-extensionslib','graphics/extensionslib-label-2.jpg','graphics/extensionslib-label-3.jpg');" src="graphics/extensionslib-label-3.jpg" vspace="0" width="120"></A><BR> |
| |
| <A href="apiDocs/index.html" onMouseOut="rolloverOff('side-ext-36');" onMouseOver="rolloverOn('side-ext-36');"><IMG alt="API Reference" border="0" height="12" hspace="0" name="side-ext-36" onLoad="rolloverLoad('side-ext-36','graphics/ext-36-label-2.jpg','graphics/ext-36-label-3.jpg');" src="graphics/ext-36-label-3.jpg" vspace="0" width="120"></A><BR> |
| |
| <IMG alt="separator" border="0" height="6" hspace="0" src="resources/separator.gif" vspace="0" width="120"><BR> |
| |
| <A href="faq.html" onMouseOut="rolloverOff('side-faq');" onMouseOver="rolloverOn('side-faq');"><IMG alt="FAQs" border="0" height="12" hspace="0" name="side-faq" onLoad="rolloverLoad('side-faq','graphics/faq-label-2.jpg','graphics/faq-label-3.jpg');" src="graphics/faq-label-3.jpg" vspace="0" width="120"></A><BR> |
| |
| <IMG alt="separator" border="0" height="6" hspace="0" src="resources/separator.gif" vspace="0" width="120"><BR> |
| |
| <A href="whatsnew.html#bugs" onMouseOut="rolloverOff('side-ext-44');" onMouseOver="rolloverOn('side-ext-44');"><IMG alt="Bugs" border="0" height="12" hspace="0" name="side-ext-44" onLoad="rolloverLoad('side-ext-44','graphics/ext-44-label-2.jpg','graphics/ext-44-label-3.jpg');" src="graphics/ext-44-label-3.jpg" vspace="0" width="120"></A><BR> |
| |
| <A href="./test/run.html#how-to-run-c" onMouseOut="rolloverOff('side-ext-46');" onMouseOver="rolloverOn('side-ext-46');"><IMG alt="Testing" border="0" height="12" hspace="0" name="side-ext-46" onLoad="rolloverLoad('side-ext-46','graphics/ext-46-label-2.jpg','graphics/ext-46-label-3.jpg');" src="graphics/ext-46-label-3.jpg" vspace="0" width="120"></A><BR> |
| |
| <IMG alt="close" border="0" height="14" hspace="0" src="resources/close.gif" vspace="0" width="120"><BR></TD><TD align="left" valign="top" width="500"><TABLE border="0" cellpadding="3" cellspacing="0"><TR><TD> |
| <UL> |
| <LI><A href="#getstarted">Samples to help you get started</A></LI> |
| <LI><A href="#rebuilding">Rebuilding a Sample application</A></LI> |
| <LI><A href="#apachemodulexslt">ApacheModuleXSLT</A></LI> |
| <LI><A href="#compilestylesheet">CompileStylesheet</A></LI> |
| <LI><A href="#documentbuilder">DocumentBuilder</A></LI> |
| <LI><A href="#externalfunctions">ExternalFunctions</A></LI> |
| <LI><A href="#parsedsourcewrappers">ParsedSourceWrappers</A></LI> |
| <LI><A href="#serializenodeset">SerializeNodeSet</A></LI> |
| <LI><A href="#simpletransform">SimpleTransform</A></LI> |
| <LI><A href="#simplexpathapi">SimpleXPathAPI</A></LI> |
| <LI><A href="#simplexpathcapi">SimpleXPathCAPI</A></LI> |
| <LI><A href="#streamtransform">StreamTransform</A></LI> |
| <LI><A href="#threadsafe">ThreadSafe</A></LI> |
| <LI><A href="#tracelisten">TraceListen</A></LI> |
| <LI><A href="#transformtoxercesdom">TransformToXercesDOM</A></LI> |
| <LI><A href="#usememorymanager">UseMemoryManager</A></LI> |
| <LI><A href="#usestylesheetparam">UseStylesheetParam</A></LI> |
| <LI><A href="#xalantransform">XalanTransform</A></LI> |
| <LI><A href="#xalantransformercallback">XalanTransformerCallback</A></LI> |
| </UL> |
| |
| <A name="getstarted"><!--anchor--></A> |
| <TABLE border="0" cellpadding="0" cellspacing="0" width="494"><TR><TD bgcolor="666699" colspan="2" width="494"><TABLE border="0" cellpadding="0" cellspacing="0" width="494"><TR><TD bgcolor="#039acc" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#039acc" height="1" width="492"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="492"></TD><TD bgcolor="#0086b2" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#039acc" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#0086b2" width="492"><FONT color="#ffffff" face="arial,helvetica,sanserif" size="+1"><IMG alt="" border="0" height="2" hspace="0" src="resources/void.gif" vspace="0" width="2"><B>Samples to help you get started</B></FONT></TD><TD bgcolor="#017299" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#0086b2" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#017299" height="1" width="492"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="492"></TD><TD bgcolor="#017299" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR></TABLE></TD></TR><TR><TD width="10"> </TD><TD width="484"><FONT color="#000000" face="arial,helvetica,sanserif"> |
| <P>Each of the subdirectories in the Xalan-C++ samples directory contains the source files for a |
| sample application. The executables for the samples are in the build subdirectory, which should be on the system |
| path.</P> |
| <P>With most of the samples, you can use the following procedure:</P> |
| <OL> |
| <LI>Go to the samples subdirectory containing the sample (use the DOS shell if you are running Windows)<BR><BR></LI> |
| <LI>Run the sample from the command line (as indicated below)<BR><BR></LI> |
| <LI>Examine the application source files. You may also want to modify the source files. Remember that if you |
| modify a .cpp file, you must rebuild the executable and place it on the path before you can run the |
| modified application.</LI> |
| </OL> |
| <TABLE border="0" cellpadding="0" cellspacing="3" width="100%"><TR><TD valign="top" width="20"><IMG alt="Note" border="0" height="24" hspace="0" src="resources/note.gif" vspace="0" width="20"></TD><TD valign="top"><FONT color="#000000" face="arial,helvetica,sanserif" size="-1"><I>Each sample application looks for input files in the current directory, the directory from |
| which you run the application. The input files are in the samples subdirectory along with the sample source |
| files. For the UNIX builds, application executables are in the bin subdirectory. For the Windows32 build, the |
| application executable is in the bin subdirectory (Xalan-C_1_10_0-<my_Windows_distribution>\bin). To run a |
| sample, be sure the executable is on the path, and run it from the samples subdirectory that contains the input |
| files.</I></FONT></TD></TR></TABLE> |
| <TABLE border="0" cellpadding="0" cellspacing="3" width="100%"><TR><TD valign="top" width="20"><IMG alt="Note" border="0" height="24" hspace="0" src="resources/note.gif" vspace="0" width="20"></TD><TD valign="top"><FONT color="#000000" face="arial,helvetica,sanserif" size="-1"><I>The most of the samples are implemented without providing a pluggable memory manager. The <A href="#simpletransform">SimpleTransform</A> sample illustrates, |
| in addition to a simple transformation, the usage of the processor with memory manager</I></FONT></TD></TR></TABLE> |
| |
| </FONT></TD></TR></TABLE><BR> |
| |
| <A name="rebuilding"><!--anchor--></A> |
| <TABLE border="0" cellpadding="0" cellspacing="0" width="494"><TR><TD bgcolor="666699" colspan="2" width="494"><TABLE border="0" cellpadding="0" cellspacing="0" width="494"><TR><TD bgcolor="#039acc" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#039acc" height="1" width="492"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="492"></TD><TD bgcolor="#0086b2" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#039acc" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#0086b2" width="492"><FONT color="#ffffff" face="arial,helvetica,sanserif" size="+1"><IMG alt="" border="0" height="2" hspace="0" src="resources/void.gif" vspace="0" width="2"><B>Rebuilding a Sample application</B></FONT></TD><TD bgcolor="#017299" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#0086b2" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#017299" height="1" width="492"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="492"></TD><TD bgcolor="#017299" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR></TABLE></TD></TR><TR><TD width="10"> </TD><TD width="484"><FONT color="#000000" face="arial,helvetica,sanserif"> |
| <P>Instructions for rebuilding the samples differ depending on whether you are using the binary package or the source |
| package. </P> |
| <P>For Windows users, the Xalan Visual C++ workspace contains project configurations for building |
| each of the samples. Users who have downloaded the source package, can find the XalanICU.dsw workspace |
| file under:<BR><BR> <CODE><FONT face="courier, monospaced">Xalan-C_1_10_0-src\src\xalanc\Projects\Win32\VC6</FONT></CODE> |
| <BR><BR> and XalanICU.sln solution file under:<BR><BR> |
| <CODE><FONT face="courier, monospaced">Xalan-C_1_10_0-src\src\xalanc\Projects\Win32\VC7.1</FONT></CODE> |
| |
| <BR><BR> Users who have downloaded the binary package, should use the Samples.dsw workspace file |
| located under: <BR><BR> |
| <CODE><FONT face="courier, monospaced">Xalan-C_1_10_0-<my_Win32_distribution>\Samples\Projects\Win32\VC6</FONT></CODE><BR><BR> |
| or the Samples.sln solution file for .NET V7.1 users, located under: <BR><BR> |
| <CODE><FONT face="courier, monospaced">Xalan-C_1_10_0-<my_Win32_distribution>\Samples\Projects\Win32\VC7.1</FONT></CODE><BR><BR> |
| </P> |
| <P>The Makefile that comes with the UNIX distributions include targets for rebuilding one or all of |
| the sample applications. To rebuild one or more sample applications from the UNIX source package, |
| go to the Xalan-C_1_10_0-src directory and run<BR><BR> |
| <CODE><FONT face="courier, monospaced">gmake <I>Target</I></FONT></CODE><BR><BR> |
| where <I>Target</I> is <CODE><FONT face="courier, monospaced">Samples</FONT></CODE> (all the samples), <CODE><FONT face="courier, monospaced">ApacheModuleXSLT</FONT></CODE>, |
| <CODE><FONT face="courier, monospaced">CompileStylesheet</FONT></CODE>, <CODE><FONT face="courier, monospaced">DocumentBuilder</FONT></CODE>, <CODE><FONT face="courier, monospaced">ExternalFunctions</FONT></CODE>, |
| <CODE><FONT face="courier, monospaced">ParsedSourceWrappers</FONT></CODE>, <CODE><FONT face="courier, monospaced">SerializedNodeSet</FONT></CODE>, <CODE><FONT face="courier, monospaced">SimpleTransform</FONT></CODE>, |
| <CODE><FONT face="courier, monospaced">SimpleXPathAPI</FONT></CODE>, <CODE><FONT face="courier, monospaced">SimpleXPathCAPI</FONT></CODE>, <CODE><FONT face="courier, monospaced">StreamTransform</FONT></CODE>, |
| <CODE><FONT face="courier, monospaced">ThreadSafe</FONT></CODE>, <CODE><FONT face="courier, monospaced">TraceListen</FONT></CODE>, <CODE><FONT face="courier, monospaced">TransformToXercesDOM</FONT></CODE>, |
| <CODE><FONT face="courier, monospaced">UseStylesheetParam</FONT></CODE>, <CODE><FONT face="courier, monospaced">XalanTransform</FONT></CODE>, or |
| <CODE><FONT face="courier, monospaced">XalanTransformerCallback</FONT></CODE>.</P> |
| <P>To rebuild the samples from the UNIX binary package, go to the ../samples directory of your installation, |
| run the runConfigure utility for your target platform, and then run gmake. For example, AIX users would |
| issue the following command:<BR><BR> |
| <CODE><FONT face="courier, monospaced">./runConfigure -p aix -c xlc_r -x xlC_r</FONT></CODE><BR> |
| <CODE><FONT face="courier, monospaced">cd samples</FONT></CODE><BR><BR> |
| <CODE><FONT face="courier, monospaced">gmake <I>Target</I></FONT></CODE><BR><BR> |
| where <I>Target</I> can be Samples (for building all samples), or the individual sample name as |
| listed above.</P> |
| <TABLE border="0" cellpadding="0" cellspacing="3" width="100%"><TR><TD valign="top" width="20"><IMG alt="Note" border="0" height="24" hspace="0" src="resources/note.gif" vspace="0" width="20"></TD><TD valign="top"><FONT color="#000000" face="arial,helvetica,sanserif" size="-1"><I>For information on building Apache Module, see <A href="samples.html#apachemodulexslt">ApacheModuleXSLT</A></I></FONT></TD></TR></TABLE> |
| </FONT></TD></TR></TABLE><BR> |
| |
| <A name="apachemodulexslt"><!--anchor--></A> |
| <TABLE border="0" cellpadding="0" cellspacing="0" width="494"><TR><TD bgcolor="666699" colspan="2" width="494"><TABLE border="0" cellpadding="0" cellspacing="0" width="494"><TR><TD bgcolor="#039acc" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#039acc" height="1" width="492"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="492"></TD><TD bgcolor="#0086b2" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#039acc" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#0086b2" width="492"><FONT color="#ffffff" face="arial,helvetica,sanserif" size="+1"><IMG alt="" border="0" height="2" hspace="0" src="resources/void.gif" vspace="0" width="2"><B>ApacheModuleXSLT</B></FONT></TD><TD bgcolor="#017299" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#0086b2" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#017299" height="1" width="492"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="492"></TD><TD bgcolor="#017299" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR></TABLE></TD></TR><TR><TD width="10"> </TD><TD width="484"><FONT color="#000000" face="arial,helvetica,sanserif"> |
| <TABLE border="0" cellpadding="0" cellspacing="3" width="100%"><TR><TD valign="top" width="20"><IMG alt="Note" border="0" height="24" hspace="0" src="resources/note.gif" vspace="0" width="20"></TD><TD valign="top"><FONT color="#000000" face="arial,helvetica,sanserif" size="-1"><I>This sample must be built with the Apache Web server, and the Xalan-C++ distribution files do not include a binary |
| for ApacheModuleXSLT. Assuming you have installed the Apache server on your platform, you can use Visual C++ on Windows to |
| build ApacheModuleXSLT.dll, or the Makefile on UNIX to build xslt_module (with the appropriate library suffix).</I></FONT></TD></TR></TABLE> |
| |
| <P>What it does: runs as an Apache module on an Apache Web server; performs transformations and returns the output to a Web |
| browser. You configure Apache to respond to a given URL request for an output file (html or txt file in the configuration below) |
| by applying an xsl stylesheet file to an xml document file (both with the specified name in a given location) and returning |
| the transformation output to the client.</P> |
| <P>This sample also illustrates use of the XalanTransformer class and the C API defined in src/XalanTransformer/XalanCAPI.h. It returns |
| transformation output in blocks to a callback function, which enables the browser to start displaying the result before the transformation |
| has been completed.</P> |
| <TABLE border="0" cellpadding="0" cellspacing="3" width="100%"><TR><TD valign="top" width="20"><IMG alt="Note" border="0" height="24" hspace="0" src="resources/note.gif" vspace="0" width="20"></TD><TD valign="top"><FONT color="#000000" face="arial,helvetica,sanserif" size="-1"><I>You may need to adjust the Visual C++ or Makefile settings to locate the required Apache header files. As shipped, the Visual C++ |
| project file looks in \Apache Group\Apache\src\include, and the UNIX Makefile looks in usr/lib.</I></FONT></TD></TR></TABLE> |
| <P>To build the Apache module, follow the instructions in <A href="build_instruct.html#win32">Steps for doing a Windows |
| build</A> or <A href="build_instruct.html#unix">Steps for doing a UNIX build</A>. For UNIX platforms, you do the build with<BR> |
| <CODE><FONT face="courier, monospaced">gmake ApacheModuleXSLT</FONT></CODE>.</P> |
| |
| <TABLE border="0" cellpadding="0" cellspacing="0" width="484"><TR><TD bgcolor="666699" colspan="2" width="484"><TABLE border="0" cellpadding="0" cellspacing="0" width="484"><TR><TD bgcolor="#039acc" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#039acc" height="1" width="482"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="482"></TD><TD bgcolor="#0086b2" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#039acc" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#0086b2" width="482"><FONT color="#ffffff" face="arial,helvetica,sanserif"><IMG alt="" border="0" height="2" hspace="0" src="resources/void.gif" vspace="0" width="2"><B>Setting up and using ApacheModuleXSLT</B></FONT></TD><TD bgcolor="#017299" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#0086b2" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#017299" height="1" width="482"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="482"></TD><TD bgcolor="#017299" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR></TABLE></TD></TR><TR><TD width="10"> </TD><TD width="474"><FONT color="#000000" face="arial,helvetica,sanserif" size="-1"> |
| <P>To use ApacheModuleXSLT, do the following:</P> |
| <OL> |
| <LI>(UNIX only) Be sure the Xalan and Xerces libraries are on your library path (you can accomplish this by copying them to |
| /usr/lib; see <A href="getstarted.html#path">Setting up the path/library path</A>), and copy the Apache module to |
| /usr/lib/apache.<BR><BR></LI> |
| <LI>Add LoadModule and (UNIX only) AddModule entries to the Apache configuration file: httpd.conf.<BR><BR> |
| Windows: <CODE><FONT face="courier, monospaced">LoadModule xslt_module Xalan-C_1_10_0-<my_Windows_distribution>\bin\ApacheModuleXSLT.dll</FONT></CODE><BR><BR> |
| UNIX: <CODE><FONT face="courier, monospaced">AddModule mod_xslt.c</FONT></CODE><BR> |
| and<BR> |
| <CODE><FONT face="courier, monospaced">LoadModule xslt_module /usr/lib/apache/mod_xslt.<I>xx</I></FONT></CODE><BR><BR> |
| where <I>xx</I> is the appropriate library suffix for the UNIX platform ("so" or "a").<BR><BR></LI> |
| <LI>Add a <Location> entry to httpd.conf that indicates where xml/xsl file pairs are to be found, and what target file extensions |
| to recognize. We suggest the following:<BR><BR> |
| <CODE><FONT face="courier, monospaced"><Location /xslt></FONT></CODE><BR> |
| <CODE><FONT face="courier, monospaced">AddHandler mod_xslt .html</FONT></CODE><BR> |
| <CODE><FONT face="courier, monospaced">AddHandler mod_xslt .txt</FONT></CODE><BR> |
| <CODE><FONT face="courier, monospaced"></Location></FONT></CODE><BR><BR> |
| This <Location> element instructs the module to respond to requests for <I>xxx</I>.html and <I>xxx</I>.txt files in the |
| in the xslt subdirectory (under the document root; see next item) by applying the <I>xxx</I>.xsl stylesheet to <I>xxx</I>.xml |
| (both in that directory) and returning the transformation result to the browser.<BR><BR> |
| For example, a request for foo.html instructs the module to apply foo.xsl to foo.xml and return the result.<BR><BR> |
| Note: It is up to the stylesheet to apply the appropriate xsl:output method to the output. Whether the user specifies html or txt is, of |
| itself, immaterial.<BR><BR></LI> |
| <LI>Put xml/xsl file pairs in the <Location> subdirectory (xslt in the example)) under the document root directory specified in |
| httpd.conf by the DocumentRoot and <Directory> settings. Alternatively, you can modify these settings to point to |
| Xalan-C_1_10_0-<my_UNIX_distribution>/samples/ApacheModuleXSLT, which includes an xslt subdirectory with xml/xsl file pairs |
| (foo.xml/xsl, apachemod.xml/xsl).<BR><BR></LI> |
| <LI>Start the Apache server.<BR><BR></LI> |
| <LI>From a Web browser, call the module with a URL as follows:<BR> |
| <CODE><FONT face="courier, monospaced">http://<I>serverName</I>/xslt/<I>xxx</I>.html</FONT></CODE><BR> |
| where <I>serverName</I> is the Apache server (such as www.myServer.com) and <I>xxx</I> is the name of an xml/xsl pair of files |
| (such as foo.xml and foo.xsl) in the xslt subdirectory under the DocumentRoot directory.<BR><BR> |
| For example,<BR> |
| <CODE><FONT face="courier, monospaced">http://www.myServer.com/xslt/apachemod.html</FONT></CODE><BR> |
| instructs ApacheModuleXSLT to apply the apachemod.xsl stylesheet to the apachemod.xml XML document (both files in the xslt directory |
| under the Apache DocumentRoot directory) and return the transformation result to the browser.</LI> |
| </OL> |
| </FONT></TD></TR></TABLE><BR> |
| </FONT></TD></TR></TABLE><BR> |
| |
| <A name="compilestylesheet"><!--anchor--></A> |
| <TABLE border="0" cellpadding="0" cellspacing="0" width="494"><TR><TD bgcolor="666699" colspan="2" width="494"><TABLE border="0" cellpadding="0" cellspacing="0" width="494"><TR><TD bgcolor="#039acc" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#039acc" height="1" width="492"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="492"></TD><TD bgcolor="#0086b2" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#039acc" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#0086b2" width="492"><FONT color="#ffffff" face="arial,helvetica,sanserif" size="+1"><IMG alt="" border="0" height="2" hspace="0" src="resources/void.gif" vspace="0" width="2"><B>CompileStylesheet</B></FONT></TD><TD bgcolor="#017299" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#0086b2" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#017299" height="1" width="492"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="492"></TD><TD bgcolor="#017299" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR></TABLE></TD></TR><TR><TD width="10"> </TD><TD width="484"><FONT color="#000000" face="arial,helvetica,sanserif"> |
| <P>What it does: Use a compiled stylesheet to perform a series of transformations.</P> |
| <P>You can run it from the CompileStylesheet subdirectory with</P> |
| <P><CODE><FONT face="courier, monospaced">CompileStylesheet</FONT></CODE></P> |
| <P>See also: <A href="usagepatterns.html#compiled">Compiling stylesheets</A>.</P> |
| </FONT></TD></TR></TABLE><BR> |
| |
| <A name="documentbuilder"><!--anchor--></A> |
| <TABLE border="0" cellpadding="0" cellspacing="0" width="494"><TR><TD bgcolor="666699" colspan="2" width="494"><TABLE border="0" cellpadding="0" cellspacing="0" width="494"><TR><TD bgcolor="#039acc" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#039acc" height="1" width="492"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="492"></TD><TD bgcolor="#0086b2" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#039acc" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#0086b2" width="492"><FONT color="#ffffff" face="arial,helvetica,sanserif" size="+1"><IMG alt="" border="0" height="2" hspace="0" src="resources/void.gif" vspace="0" width="2"><B>DocumentBuilder</B></FONT></TD><TD bgcolor="#017299" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#0086b2" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#017299" height="1" width="492"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="492"></TD><TD bgcolor="#017299" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR></TABLE></TD></TR><TR><TD width="10"> </TD><TD width="484"><FONT color="#000000" face="arial,helvetica,sanserif"> |
| <P>What it does: Use a DocumentBuilder to programmatically construct an XML document, apply the foo.xsl stylesheet to |
| this document, and write the ouput to foo.out.</P> |
| <P>You can run it from the DocumentBuilder subdirectory with</P> |
| <P><CODE><FONT face="courier, monospaced">DocumentBuilder</FONT></CODE></P> |
| </FONT></TD></TR></TABLE><BR> |
| |
| <A name="externalfunctions"><!--anchor--></A> |
| <TABLE border="0" cellpadding="0" cellspacing="0" width="494"><TR><TD bgcolor="666699" colspan="2" width="494"><TABLE border="0" cellpadding="0" cellspacing="0" width="494"><TR><TD bgcolor="#039acc" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#039acc" height="1" width="492"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="492"></TD><TD bgcolor="#0086b2" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#039acc" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#0086b2" width="492"><FONT color="#ffffff" face="arial,helvetica,sanserif" size="+1"><IMG alt="" border="0" height="2" hspace="0" src="resources/void.gif" vspace="0" width="2"><B>ExternalFunctions</B></FONT></TD><TD bgcolor="#017299" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#0086b2" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#017299" height="1" width="492"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="492"></TD><TD bgcolor="#017299" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR></TABLE></TD></TR><TR><TD width="10"> </TD><TD width="484"><FONT color="#000000" face="arial,helvetica,sanserif"> |
| <P>What it does: implement, install, and illustrate the usage of three extension functions. The functions return a |
| square root, a cube, and a string with the current date and time. The sample stylesheet (foo.xsl) gets the area |
| of a cube and units of measurement from an XML document (foo.xml), computes the length of each side |
| of a cube and the volume of the cube, and enters the date and time of the transformation. The output appears in |
| foo.out.</P> |
| <P>Run this sample from the ExternalFunctions subdirectory with</P> |
| <P><CODE><FONT face="courier, monospaced">ExternalFunctions</FONT></CODE></P> |
| <P>See also: <A href="extensions.html">Extension Functions</A>.</P> |
| </FONT></TD></TR></TABLE><BR> |
| |
| <A name="parsedsourcewrappers"><!--anchor--></A> |
| <TABLE border="0" cellpadding="0" cellspacing="0" width="494"><TR><TD bgcolor="666699" colspan="2" width="494"><TABLE border="0" cellpadding="0" cellspacing="0" width="494"><TR><TD bgcolor="#039acc" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#039acc" height="1" width="492"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="492"></TD><TD bgcolor="#0086b2" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#039acc" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#0086b2" width="492"><FONT color="#ffffff" face="arial,helvetica,sanserif" size="+1"><IMG alt="" border="0" height="2" hspace="0" src="resources/void.gif" vspace="0" width="2"><B>ParsedSourceWrappers</B></FONT></TD><TD bgcolor="#017299" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#0086b2" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#017299" height="1" width="492"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="492"></TD><TD bgcolor="#017299" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR></TABLE></TD></TR><TR><TD width="10"> </TD><TD width="484"><FONT color="#000000" face="arial,helvetica,sanserif"> |
| <P>What it does: performs a transformation with input in the form of a pre-built XercesDOM or XalanSourceTree.</P> |
| <P>Run this sample from the ParsedSourceWrappers subdirectory with</P> |
| <P><CODE><FONT face="courier, monospaced">ParsedSourceWrappers</FONT></CODE></P> |
| <P>See transformXercesDOM() and transformXalanSourceTree() as called by transform() in ParsedSourceWrappers.cpp.</P> |
| </FONT></TD></TR></TABLE><BR> |
| |
| <A name="serializenodeset"><!--anchor--></A> |
| <TABLE border="0" cellpadding="0" cellspacing="0" width="494"><TR><TD bgcolor="666699" colspan="2" width="494"><TABLE border="0" cellpadding="0" cellspacing="0" width="494"><TR><TD bgcolor="#039acc" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#039acc" height="1" width="492"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="492"></TD><TD bgcolor="#0086b2" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#039acc" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#0086b2" width="492"><FONT color="#ffffff" face="arial,helvetica,sanserif" size="+1"><IMG alt="" border="0" height="2" hspace="0" src="resources/void.gif" vspace="0" width="2"><B>SerializeNodeSet</B></FONT></TD><TD bgcolor="#017299" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#0086b2" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#017299" height="1" width="492"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="492"></TD><TD bgcolor="#017299" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR></TABLE></TD></TR><TR><TD width="10"> </TD><TD width="484"><FONT color="#000000" face="arial,helvetica,sanserif"> |
| <P>What it does: Serialize the node set returned by the application of an XPath expression to an XML document.</P> |
| <P>Run this sample from the SerializeNodeSet subdirectory with</P> |
| <P><CODE><FONT face="courier, monospaced">SerializeNodeSet <I>XMLFile</I> <I>ContextNode</I> <I>XPathExpression</I></FONT></CODE></P> |
| <P>where <I>XMLFile</I> is an XML source file, <I>ContextNode</I> is the location path to the context |
| node, and <I>XPathExpression</I> is an XPath expression to apply to that context node. The SerializeNodeSet |
| directory contains the same foo.xml sample source file as the preceding examples.</P> |
| </FONT></TD></TR></TABLE><BR> |
| |
| <A name="simpletransform"><!--anchor--></A> |
| <TABLE border="0" cellpadding="0" cellspacing="0" width="494"><TR><TD bgcolor="666699" colspan="2" width="494"><TABLE border="0" cellpadding="0" cellspacing="0" width="494"><TR><TD bgcolor="#039acc" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#039acc" height="1" width="492"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="492"></TD><TD bgcolor="#0086b2" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#039acc" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#0086b2" width="492"><FONT color="#ffffff" face="arial,helvetica,sanserif" size="+1"><IMG alt="" border="0" height="2" hspace="0" src="resources/void.gif" vspace="0" width="2"><B>SimpleTransform</B></FONT></TD><TD bgcolor="#017299" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#0086b2" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#017299" height="1" width="492"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="492"></TD><TD bgcolor="#017299" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR></TABLE></TD></TR><TR><TD width="10"> </TD><TD width="484"><FONT color="#000000" face="arial,helvetica,sanserif"> |
| <P>What it does: The SimpleTransform class uses the foo.xsl stylesheet to transform foo.xml, and writes the |
| output to foo.out. The source for this sample has been modified to demonstrate the usage of the new pluggable |
| memory management feature.</P> |
| <P>You can run it from the SimpleTransform subdirectory with</P> |
| <P><CODE><FONT face="courier, monospaced">SimpleTransform</FONT></CODE></P> |
| <P>See also: <A href="usagepatterns.html#xalantransformer">Basic procedures for performing XSL |
| transformations</A>.</P> |
| </FONT></TD></TR></TABLE><BR> |
| |
| <A name="simplexpathapi"><!--anchor--></A> |
| <TABLE border="0" cellpadding="0" cellspacing="0" width="494"><TR><TD bgcolor="666699" colspan="2" width="494"><TABLE border="0" cellpadding="0" cellspacing="0" width="494"><TR><TD bgcolor="#039acc" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#039acc" height="1" width="492"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="492"></TD><TD bgcolor="#0086b2" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#039acc" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#0086b2" width="492"><FONT color="#ffffff" face="arial,helvetica,sanserif" size="+1"><IMG alt="" border="0" height="2" hspace="0" src="resources/void.gif" vspace="0" width="2"><B>SimpleXPathAPI</B></FONT></TD><TD bgcolor="#017299" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#0086b2" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#017299" height="1" width="492"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="492"></TD><TD bgcolor="#017299" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR></TABLE></TD></TR><TR><TD width="10"> </TD><TD width="484"><FONT color="#000000" face="arial,helvetica,sanserif"> |
| <P>What it does: Use the XPathEvaluator interface to evaluate an XPath expression from the specified context node of |
| an XML file and display the nodeset returned by the expression.</P> |
| <TABLE border="0" cellpadding="0" cellspacing="3" width="100%"><TR><TD valign="top" width="20"><IMG alt="Note" border="0" height="24" hspace="0" src="resources/note.gif" vspace="0" width="20"></TD><TD valign="top"><FONT color="#000000" face="arial,helvetica,sanserif" size="-1"><I>You can use this sample as an aid when you want to find out what a given XPath expression returns from a |
| given context node in an XML file.</I></FONT></TD></TR></TABLE> |
| <P>Run this sample from the SimpleXPathAPI subdirectory with</P> |
| <P><CODE><FONT face="courier, monospaced">SimpleXPathAPI <I>XMLFile</I> <I>ContextNode</I> <I>XPathExpression</I></FONT></CODE></P> |
| <P>where <I>XMLFile</I> is an XML source file, <I>ContextNode</I> is the location path to the context |
| node, and <I>XPathExpression</I> is an XPath expression to apply to that context node.</P> |
| <TABLE border="0" cellpadding="0" cellspacing="3" width="100%"><TR><TD valign="top" width="20"><IMG alt="Note" border="0" height="24" hspace="0" src="resources/note.gif" vspace="0" width="20"></TD><TD valign="top"><FONT color="#000000" face="arial,helvetica,sanserif" size="-1"><I>Keep in mind that the string value returned by an XPath expression is the string value of the first node in the |
| nodeset returned by the expresssion.</I></FONT></TD></TR></TABLE> |
| <P>The XPathWrapper subdirectory contains an XML file named xml.foo (part of it appears below).</P> |
| <DIV align="right"><TABLE border="0" cellpadding="0" cellspacing="4" width="464"><TR><TD bgcolor="#0086b2" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#0086b2" height="1" width="462"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="462"></TD><TD bgcolor="#0086b2" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#0086b2" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#ffffff" width="462"><FONT size="-1"><PRE> |
| <?xml version="1.0"?> |
| <doc> |
| <name first="David" last="Marston">Mr. Marson</name> |
| <name first="David" last="Bertoni">Mr. Bertoni</name> |
| ... |
| <name first="Paul" last="Dick">Mr. Dick</name> |
| </doc> |
| </PRE></FONT></TD><TD bgcolor="#0086b2" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#0086b2" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#0086b2" height="1" width="462"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="462"></TD><TD bgcolor="#0086b2" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR></TABLE></DIV> |
| <P>You can try command lines like</P> |
| <P><CODE><FONT face="courier, monospaced">SimpleXPathAPI foo.xml /doc name/@last</FONT></CODE></P> |
| <P>and</P> |
| <P><CODE><FONT face="courier, monospaced">SimpleXPathAPI foo.xml / '//name[position()="4"]/@first'</FONT></CODE></P> |
| <TABLE border="0" cellpadding="0" cellspacing="3" width="100%"><TR><TD valign="top" width="20"><IMG alt="Note" border="0" height="24" hspace="0" src="resources/note.gif" vspace="0" width="20"></TD><TD valign="top"><FONT color="#000000" face="arial,helvetica,sanserif" size="-1"><I>If a SimpleXPathAPI argument includes characters (such as *) that the shell interprets incorrectly, enclose the argument |
| in double quotes.</I></FONT></TD></TR></TABLE> |
| <P>See also: <A href="usagepatterns.html#xpath">Working with XPath expressions</A>.</P> |
| </FONT></TD></TR></TABLE><BR> |
| |
| <A name="simplexpathcapi"><!--anchor--></A> |
| <TABLE border="0" cellpadding="0" cellspacing="0" width="494"><TR><TD bgcolor="666699" colspan="2" width="494"><TABLE border="0" cellpadding="0" cellspacing="0" width="494"><TR><TD bgcolor="#039acc" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#039acc" height="1" width="492"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="492"></TD><TD bgcolor="#0086b2" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#039acc" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#0086b2" width="492"><FONT color="#ffffff" face="arial,helvetica,sanserif" size="+1"><IMG alt="" border="0" height="2" hspace="0" src="resources/void.gif" vspace="0" width="2"><B>SimpleXPathCAPI</B></FONT></TD><TD bgcolor="#017299" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#0086b2" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#017299" height="1" width="492"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="492"></TD><TD bgcolor="#017299" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR></TABLE></TD></TR><TR><TD width="10"> </TD><TD width="484"><FONT color="#000000" face="arial,helvetica,sanserif"> |
| <P>What it does: Use the XPathEvaluator C interface to evaluate an XPath epxeression and display the string value returned |
| by the epxression.</P> |
| <TABLE border="0" cellpadding="0" cellspacing="3" width="100%"><TR><TD valign="top" width="20"><IMG alt="Note" border="0" height="24" hspace="0" src="resources/note.gif" vspace="0" width="20"></TD><TD valign="top"><FONT color="#000000" face="arial,helvetica,sanserif" size="-1"><I>Keep in mind that the string value returned by an XPath expression is the string value of the first node in the nodeset |
| returned by the epxresssion.</I></FONT></TD></TR></TABLE> |
| <P>Run this sample from the SimpleXPathCAPI subdirectory with</P> |
| <P><CODE><FONT face="courier, monospaced">SimpleXPathCAPI <I>XMLFile</I> <I>XPathExpression</I></FONT></CODE></P> |
| <P>where <I>XMLFile</I> is an XML source file, and <I>XPathExpression</I> is an XPath expression to apply to the XML |
| source file. The SimpleXPathCAPI subdirectory contains an XML file named xml.foo identical to foo.xml in the preceding |
| example.</P> |
| <P>You can try command lines like</P> |
| <P><CODE><FONT face="courier, monospaced">SimpleXPathCAPI foo.xml /doc/name[3]</FONT></CODE></P> |
| </FONT></TD></TR></TABLE><BR> |
| |
| <A name="streamtransform"><!--anchor--></A> |
| <TABLE border="0" cellpadding="0" cellspacing="0" width="494"><TR><TD bgcolor="666699" colspan="2" width="494"><TABLE border="0" cellpadding="0" cellspacing="0" width="494"><TR><TD bgcolor="#039acc" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#039acc" height="1" width="492"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="492"></TD><TD bgcolor="#0086b2" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#039acc" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#0086b2" width="492"><FONT color="#ffffff" face="arial,helvetica,sanserif" size="+1"><IMG alt="" border="0" height="2" hspace="0" src="resources/void.gif" vspace="0" width="2"><B>StreamTransform</B></FONT></TD><TD bgcolor="#017299" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#0086b2" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#017299" height="1" width="492"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="492"></TD><TD bgcolor="#017299" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR></TABLE></TD></TR><TR><TD width="10"> </TD><TD width="484"><FONT color="#000000" face="arial,helvetica,sanserif"> |
| <P>What it does: The StreamTransform class processes character input streams containing a stylesheet and an XML document, and |
| writes the transformation output to a character output stream. This sample illustrates the process for working with stylesheets |
| and documents that you assemble in memory.</P> |
| <P>You can run it from the SimpleTransform subdirectory with</P> |
| <P><CODE><FONT face="courier, monospaced">StreamTransform</FONT></CODE></P> |
| </FONT></TD></TR></TABLE><BR> |
| |
| <A name="threadsafe"><!--anchor--></A> |
| <TABLE border="0" cellpadding="0" cellspacing="0" width="494"><TR><TD bgcolor="666699" colspan="2" width="494"><TABLE border="0" cellpadding="0" cellspacing="0" width="494"><TR><TD bgcolor="#039acc" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#039acc" height="1" width="492"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="492"></TD><TD bgcolor="#0086b2" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#039acc" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#0086b2" width="492"><FONT color="#ffffff" face="arial,helvetica,sanserif" size="+1"><IMG alt="" border="0" height="2" hspace="0" src="resources/void.gif" vspace="0" width="2"><B>ThreadSafe</B></FONT></TD><TD bgcolor="#017299" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#0086b2" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#017299" height="1" width="492"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="492"></TD><TD bgcolor="#017299" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR></TABLE></TD></TR><TR><TD width="10"> </TD><TD width="484"><FONT color="#000000" face="arial,helvetica,sanserif"> |
| <P>What it does: Multiple threads use a single compiled stylesheet (StylesheetRoot) and DOM source tree (XalanNode) to perform |
| transformations concurrently. The application tracks the progress of the threads in messages to the console, and each thread |
| writes its own output file. Imagine a server application responding to multiple clients who happen to request the same |
| transformation.</P> |
| <P>You can run it from the ThreadSafe subdirectory with</P> |
| <P><CODE><FONT face="courier, monospaced">ThreadSafe</FONT></CODE></P> |
| <P>See also: <A href="usagepatterns.html#compiled">Compiling stylesheets</A>.</P> |
| </FONT></TD></TR></TABLE><BR> |
| |
| <A name="tracelisten"><!--anchor--></A> |
| <TABLE border="0" cellpadding="0" cellspacing="0" width="494"><TR><TD bgcolor="666699" colspan="2" width="494"><TABLE border="0" cellpadding="0" cellspacing="0" width="494"><TR><TD bgcolor="#039acc" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#039acc" height="1" width="492"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="492"></TD><TD bgcolor="#0086b2" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#039acc" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#0086b2" width="492"><FONT color="#ffffff" face="arial,helvetica,sanserif" size="+1"><IMG alt="" border="0" height="2" hspace="0" src="resources/void.gif" vspace="0" width="2"><B>TraceListen</B></FONT></TD><TD bgcolor="#017299" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#0086b2" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#017299" height="1" width="492"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="492"></TD><TD bgcolor="#017299" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR></TABLE></TD></TR><TR><TD width="10"> </TD><TD width="484"><FONT color="#000000" face="arial,helvetica,sanserif"> |
| <P>What it does: Trace events during a transformation; the transformation uses birds.xsl to transform birds.xml and writes the |
| output to birds.out.</P> |
| <P>You can run it from the TraceListen subdirectory with</P> |
| <P><CODE><FONT face="courier, monospaced">TraceListen <I>traceFlags</I></FONT></CODE></P> |
| <P>where <I>traceFlags</I> is one or more of the following:</P> |
| <P> <CODE><FONT face="courier, monospaced">-tt</FONT></CODE> (Trace the templates as they are being called)</P> |
| <P> <CODE><FONT face="courier, monospaced">-tg</FONT></CODE> (Trace each result tree generation event)</P> |
| <P> <CODE><FONT face="courier, monospaced">-ts</FONT></CODE> (Trace each selection event)</P> |
| <P> <CODE><FONT face="courier, monospaced">-ttc</FONT></CODE> (Trace the template children as they are being processed)</P> |
| <P>These flags are also available in the <A href="commandline.html">command-line utility (TestXSLT)</A>.</P> |
| <P>The core of this example is the following fragment:</P> |
| <DIV align="right"><TABLE border="0" cellpadding="0" cellspacing="4" width="464"><TR><TD bgcolor="#0086b2" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#0086b2" height="1" width="462"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="462"></TD><TD bgcolor="#0086b2" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#0086b2" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#ffffff" width="462"><FONT size="-1"><PRE> |
| // Set up a diagnostic writer to be used by the TraceListener... |
| XalanStdOutputStream theStdErr(cerr); |
| XalanOutputStreamPrintWriter diagnosticsWriter(theStdErr); |
| // Make sure that error reporting, which includes any TraceListener |
| // output does not throw exceptions when transcoding, since that could |
| // result in an exception being thrown while another exception is active. |
| // In particular, characters that the TraceListener writes might not be |
| // representable in the local code page. |
| theStdErr.setThrowTranscodeException(false); |
| |
| // Set up the TraceListener... |
| // traceTemplates, traceTemplateChildren, traceGenerationEvent, |
| // and TraceSelectionEvent are booleans set by the command line. |
| TraceListenerDefault theTraceListener( |
| diagnosticsWriter, |
| traceTemplates, |
| traceTemplateChildren, |
| traceGenerationEvent, |
| traceSelectionEvent); |
| |
| // Add the TraceListener to the XSLT processor... |
| theProcessor.setTraceSelects(traceSelectionEvent); |
| theProcessor.addTraceListener(&theTraceListener); |
| |
| // Perform the transformation |
| .... |
| </PRE></FONT></TD><TD bgcolor="#0086b2" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#0086b2" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#0086b2" height="1" width="462"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="462"></TD><TD bgcolor="#0086b2" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR></TABLE></DIV> |
| </FONT></TD></TR></TABLE><BR> |
| |
| <A name="transformtoxercesdom"><!--anchor--></A> |
| <TABLE border="0" cellpadding="0" cellspacing="0" width="494"><TR><TD bgcolor="666699" colspan="2" width="494"><TABLE border="0" cellpadding="0" cellspacing="0" width="494"><TR><TD bgcolor="#039acc" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#039acc" height="1" width="492"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="492"></TD><TD bgcolor="#0086b2" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#039acc" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#0086b2" width="492"><FONT color="#ffffff" face="arial,helvetica,sanserif" size="+1"><IMG alt="" border="0" height="2" hspace="0" src="resources/void.gif" vspace="0" width="2"><B>TransformToXercesDOM</B></FONT></TD><TD bgcolor="#017299" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#0086b2" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#017299" height="1" width="492"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="492"></TD><TD bgcolor="#017299" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR></TABLE></TD></TR><TR><TD width="10"> </TD><TD width="484"><FONT color="#000000" face="arial,helvetica,sanserif"> |
| <P>What it does: Performs a simple transformation but puts the result in a Xerces DOMDocument</P> |
| <P>Run this sample from the TransformToXercesDOM subdirectory with</P> |
| <P><CODE><FONT face="courier, monospaced">TransformToXercesDOM <I>XMLFile</I> <I>XSLFile</I></FONT></CODE></P> |
| <P>where <I>XMLFile</I> is a source XML file, and <I>XSLFile</I> is the XLST input file. The program will use |
| <I>XSLFile</I> to transform the input file <I>XMLFile</I> using Xerces DOM as the output destination.</P> |
| <P>See the FormatterToXercesDOM usage in the sample code.</P> |
| </FONT></TD></TR></TABLE><BR> |
| |
| <A name="usestylesheetparam"><!--anchor--></A> |
| <TABLE border="0" cellpadding="0" cellspacing="0" width="494"><TR><TD bgcolor="666699" colspan="2" width="494"><TABLE border="0" cellpadding="0" cellspacing="0" width="494"><TR><TD bgcolor="#039acc" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#039acc" height="1" width="492"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="492"></TD><TD bgcolor="#0086b2" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#039acc" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#0086b2" width="492"><FONT color="#ffffff" face="arial,helvetica,sanserif" size="+1"><IMG alt="" border="0" height="2" hspace="0" src="resources/void.gif" vspace="0" width="2"><B>UseStylesheetParam</B></FONT></TD><TD bgcolor="#017299" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#0086b2" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#017299" height="1" width="492"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="492"></TD><TD bgcolor="#017299" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR></TABLE></TD></TR><TR><TD width="10"> </TD><TD width="484"><FONT color="#000000" face="arial,helvetica,sanserif"> |
| <P>What it does: Set a stylesheet parameter that the stylesheet uses during the transformation.</P> |
| <P>You can run it from the UseStylesheetParam subdirectory with</P> |
| <P><CODE><FONT face="courier, monospaced">UseStylesheetParam <I>key expression</I></FONT></CODE></P> |
| <P>where <I>key</I> is the parameter key (or name) and <I>expression</I> is a string expression enclosed |
| in single quotes.</P> |
| <P>The example uses a stylesheet (foo.xsl) with a parameter named param1. The stylesheet accepts any string |
| expression. Enclose the string expression in single quotes (so it is interpreted as an expression); if it |
| includes more than a single word, enclose the resulting string in double quotes so the executable interprets it |
| as a single argument. For example:</P> |
| <P><CODE><FONT face="courier, monospaced">UseStylesheetParam param1 "'hello out there'"</FONT></CODE></P> |
| <P>See also: <A href="usagepatterns.html#params">Setting stylesheet parameters</A>.</P> |
| </FONT></TD></TR></TABLE><BR> |
| |
| <A name="xalantransform"><!--anchor--></A> |
| <TABLE border="0" cellpadding="0" cellspacing="0" width="494"><TR><TD bgcolor="666699" colspan="2" width="494"><TABLE border="0" cellpadding="0" cellspacing="0" width="494"><TR><TD bgcolor="#039acc" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#039acc" height="1" width="492"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="492"></TD><TD bgcolor="#0086b2" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#039acc" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#0086b2" width="492"><FONT color="#ffffff" face="arial,helvetica,sanserif" size="+1"><IMG alt="" border="0" height="2" hspace="0" src="resources/void.gif" vspace="0" width="2"><B>XalanTransform</B></FONT></TD><TD bgcolor="#017299" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#0086b2" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#017299" height="1" width="492"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="492"></TD><TD bgcolor="#017299" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR></TABLE></TD></TR><TR><TD width="10"> </TD><TD width="484"><FONT color="#000000" face="arial,helvetica,sanserif"> |
| <P>What it does: XalanTransform uses the XalanTransformer class and the associated C++ API to apply an XSL stylesheet |
| file to an XML document file and write the transformation output to either an output file or to a stream. XalanTransform |
| takes command-line arguments for the XML document to be transformed, the XSL stylesheet to apply, and an optional output |
| file argument. If you omit the third argument, XalanTransform writes the transformation output to a stream that is sent to |
| standard out (the console).</P> |
| <P>You can run XalanTransform from the XalanTransform subdirectory with</P> |
| <P><CODE><FONT face="courier, monospaced">XalanTransform foo.xml foo.xsl foo.out</FONT></CODE></P> |
| <P>Omit the third argument to write the transformation result to the console. See also: <A href="usagepatterns.html#xalantransformer">Using the XalanTransformer class.</A>.</P> |
| </FONT></TD></TR></TABLE><BR> |
| |
| <A name="xalantransformercallback"><!--anchor--></A> |
| <TABLE border="0" cellpadding="0" cellspacing="0" width="494"><TR><TD bgcolor="666699" colspan="2" width="494"><TABLE border="0" cellpadding="0" cellspacing="0" width="494"><TR><TD bgcolor="#039acc" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#039acc" height="1" width="492"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="492"></TD><TD bgcolor="#0086b2" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#039acc" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#0086b2" width="492"><FONT color="#ffffff" face="arial,helvetica,sanserif" size="+1"><IMG alt="" border="0" height="2" hspace="0" src="resources/void.gif" vspace="0" width="2"><B>XalanTransformerCallback</B></FONT></TD><TD bgcolor="#017299" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#0086b2" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#017299" height="1" width="492"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="492"></TD><TD bgcolor="#017299" height="1" width="1"><IMG alt="" border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR></TABLE></TD></TR><TR><TD width="10"> </TD><TD width="484"><FONT color="#000000" face="arial,helvetica,sanserif"> |
| <P>What it does: Return transformation output in blocks to a callback function, which writes the output to a file. |
| This sample illustrates the use of a callback function to incrementally process a transformation result, that is to begin |
| working with the transformation result before the transformation has been completed. See <A href="usagepatterns.html#incremental">Processing output incrementally</A>.</P> |
| <P>You can run it from the XalanTransformerCallback subdirectory with</P> |
| <P><CODE><FONT face="courier, monospaced">XalanTransformerCallback foo.xml foo.xsl [foo.out]</FONT></CODE></P> |
| <TABLE border="0" cellpadding="0" cellspacing="3" width="100%"><TR><TD valign="top" width="20"><IMG alt="Note" border="0" height="24" hspace="0" src="resources/note.gif" vspace="0" width="20"></TD><TD valign="top"><FONT color="#000000" face="arial,helvetica,sanserif" size="-1"><I>If you omit the third argument, the transformation result is written to the console.</I></FONT></TD></TR></TABLE> |
| </FONT></TD></TR></TABLE><BR> |
| |
| </TD></TR></TABLE></TD></TR></TABLE><BR><TABLE border="0" cellpadding="0" cellspacing="0" width="620"><TR><TD bgcolor="#0086b2"><IMG alt="dot" height="1" src="images/dot.gif" width="1"></TD></TR><TR><TD align="center"><FONT color="#0086b2" size="-1"><I> |
| Copyright © 1999-2004 The Apache Software Foundation. |
| All Rights Reserved. |
| </I></FONT></TD></TR></TABLE></BODY></HTML> |