| <HTML><HEAD><SCRIPT language="JavaScript" src="resources/script.js" type="text/javascript"></SCRIPT><TITLE>Command line options for XSLTC</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/commandline_xsltc-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="http://xalan.apache.org/index.html" onMouseOut="rolloverOff('side-ext-4');" onMouseOver="rolloverOn('side-ext-4');"><IMG alt="Home" border="0" height="12" hspace="0" name="side-ext-4" onLoad="rolloverLoad('side-ext-4','graphics/ext-4-label-2.jpg','graphics/ext-4-label-3.jpg');" src="graphics/ext-4-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="index.html" onMouseOut="rolloverOff('side-index');" onMouseOver="rolloverOn('side-index');"><IMG alt="Xalan-J 2.7.1" 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="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> |
| <IMG alt="separator" border="0" height="6" hspace="0" src="resources/separator.gif" vspace="0" width="120"><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> |
| <A href="readme.html" onMouseOut="rolloverOff('side-readme');" onMouseOver="rolloverOn('side-readme');"><IMG alt="Release Notes" border="0" height="12" hspace="0" name="side-readme" onLoad="rolloverLoad('side-readme','graphics/readme-label-2.jpg','graphics/readme-label-3.jpg');" src="graphics/readme-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="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="downloads.html" onMouseOut="rolloverOff('side-downloads');" onMouseOver="rolloverOn('side-downloads');"><IMG alt="Download/Build" border="0" height="12" hspace="0" name="side-downloads" onLoad="rolloverLoad('side-downloads','graphics/downloads-label-2.jpg','graphics/downloads-label-3.jpg');" src="graphics/downloads-label-3.jpg" vspace="0" width="120"></A><BR> |
| <A href="getstarted.html" onMouseOut="rolloverOff('side-getstarted');" onMouseOver="rolloverOn('side-getstarted');"><IMG alt="Getting Started" border="0" height="12" hspace="0" name="side-getstarted" onLoad="rolloverLoad('side-getstarted','graphics/getstarted-label-2.jpg','graphics/getstarted-label-3.jpg');" src="graphics/getstarted-label-3.jpg" vspace="0" width="120"></A><BR> |
| <A href="xsltc_usage.html" onMouseOut="rolloverOff('side-xsltc_usage');" onMouseOver="rolloverOn('side-xsltc_usage');"><IMG alt="Using XSLTC" border="0" height="12" hspace="0" name="side-xsltc_usage" onLoad="rolloverLoad('side-xsltc_usage','graphics/xsltc_usage-label-2.jpg','graphics/xsltc_usage-label-3.jpg');" src="graphics/xsltc_usage-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="samples.html" onMouseOut="rolloverOff('side-samples');" onMouseOver="rolloverOn('side-samples');"><IMG alt="Sample Apps" border="0" height="12" hspace="0" name="side-samples" onLoad="rolloverLoad('side-samples','graphics/samples-label-2.jpg','graphics/samples-label-3.jpg');" src="graphics/samples-label-3.jpg" vspace="0" width="120"></A><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> |
| |
| <IMG alt="separator" border="0" height="6" hspace="0" src="resources/separator.gif" vspace="0" width="120"><BR> |
| <A href="features.html" onMouseOut="rolloverOff('side-features');" onMouseOver="rolloverOn('side-features');"><IMG alt="Features" border="0" height="12" hspace="0" name="side-features" onLoad="rolloverLoad('side-features','graphics/features-label-2.jpg','graphics/features-label-3.jpg');" src="graphics/features-label-3.jpg" vspace="0" width="120"></A><BR> |
| <A href="trax.html" onMouseOut="rolloverOff('side-trax');" onMouseOver="rolloverOn('side-trax');"><IMG alt="Transform API" border="0" height="12" hspace="0" name="side-trax" onLoad="rolloverLoad('side-trax','graphics/trax-label-2.jpg','graphics/trax-label-3.jpg');" src="graphics/trax-label-3.jpg" vspace="0" width="120"></A><BR> |
| <A href="xpath_apis.html" onMouseOut="rolloverOff('side-xpath_apis');" onMouseOver="rolloverOn('side-xpath_apis');"><IMG alt="XPath API" border="0" height="12" hspace="0" name="side-xpath_apis" onLoad="rolloverLoad('side-xpath_apis','graphics/xpath_apis-label-2.jpg','graphics/xpath_apis-label-3.jpg');" src="graphics/xpath_apis-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="apidocs/index.html" onMouseOut="rolloverOff('side-ext-52');" onMouseOver="rolloverOn('side-ext-52');"><IMG alt="Xalan-J API" border="0" height="12" hspace="0" name="side-ext-52" onLoad="rolloverLoad('side-ext-52','graphics/ext-52-label-2.jpg','graphics/ext-52-label-3.jpg');" src="graphics/ext-52-label-3.jpg" vspace="0" width="120"></A><BR> |
| <A href="public_apis.html" onMouseOut="rolloverOff('side-public_apis');" onMouseOver="rolloverOn('side-public_apis');"><IMG alt="Public APIs" border="0" height="12" hspace="0" name="side-public_apis" onLoad="rolloverLoad('side-public_apis','graphics/public_apis-label-2.jpg','graphics/public_apis-label-3.jpg');" src="graphics/public_apis-label-3.jpg" vspace="0" width="120"></A><BR> |
| <A href="dtm.html" onMouseOut="rolloverOff('side-dtm');" onMouseOver="rolloverOn('side-dtm');"><IMG alt="DTM" border="0" height="12" hspace="0" name="side-dtm" onLoad="rolloverLoad('side-dtm','graphics/dtm-label-2.jpg','graphics/dtm-label-3.jpg');" src="graphics/dtm-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="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="extensions_xsltc.html" onMouseOut="rolloverOff('side-extensions_xsltc');" onMouseOver="rolloverOn('side-extensions_xsltc');"><IMG alt="XSLTC Exts" border="0" height="12" hspace="0" name="side-extensions_xsltc" onLoad="rolloverLoad('side-extensions_xsltc','graphics/extensions_xsltc-label-2.jpg','graphics/extensions_xsltc-label-3.jpg');" src="graphics/extensions_xsltc-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="design/design2_0_0.html" onMouseOut="rolloverOff('side-ext-68');" onMouseOver="rolloverOn('side-ext-68');"><IMG alt="Xalan 2 Design" border="0" height="12" hspace="0" name="side-ext-68" onLoad="rolloverLoad('side-ext-68','graphics/ext-68-label-2.jpg','graphics/ext-68-label-3.jpg');" src="graphics/ext-68-label-3.jpg" vspace="0" width="120"></A><BR> |
| <A href="xsltc/index.html" onMouseOut="rolloverOff('side-ext-70');" onMouseOver="rolloverOn('side-ext-70');"><IMG alt="XSLTC Design" border="0" height="12" hspace="0" name="side-ext-70" onLoad="rolloverLoad('side-ext-70','graphics/ext-70-label-2.jpg','graphics/ext-70-label-3.jpg');" src="graphics/ext-70-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="builds.html" onMouseOut="rolloverOff('side-builds');" onMouseOver="rolloverOn('side-builds');"><IMG alt="Building a release" border="0" height="12" hspace="0" name="side-builds" onLoad="rolloverLoad('side-builds','graphics/builds-label-2.jpg','graphics/builds-label-3.jpg');" src="graphics/builds-label-3.jpg" vspace="0" width="120"></A><BR> |
| <A href="./test/overview.html" onMouseOut="rolloverOff('side-ext-76');" onMouseOver="rolloverOn('side-ext-76');"><IMG alt="Testing" border="0" height="12" hspace="0" name="side-ext-76" onLoad="rolloverLoad('side-ext-76','graphics/ext-76-label-2.jpg','graphics/ext-76-label-3.jpg');" src="graphics/ext-76-label-3.jpg" vspace="0" width="120"></A><BR> |
| <A href="bugreporting.html" onMouseOut="rolloverOff('side-bugreporting');" onMouseOver="rolloverOn('side-bugreporting');"><IMG alt="Bug Reporting" border="0" height="12" hspace="0" name="side-bugreporting" onLoad="rolloverLoad('side-bugreporting','graphics/bugreporting-label-2.jpg','graphics/bugreporting-label-3.jpg');" src="graphics/bugreporting-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="contact_us.html" onMouseOut="rolloverOff('side-contact_us');" onMouseOver="rolloverOn('side-contact_us');"><IMG alt="Contact us" border="0" height="12" hspace="0" name="side-contact_us" onLoad="rolloverLoad('side-contact_us','graphics/contact_us-label-2.jpg','graphics/contact_us-label-3.jpg');" src="graphics/contact_us-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="#options">Options</A></LI> |
| <LI><A href="#examples">Examples</A></LI> |
| <LI><A href="#faq">Simple FAQs</A></LI> |
| <LI><A href="#trax">Using options from the JAXP transform APIs</A></LI> |
| </UL> |
| |
| <A name="options"><!--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>Options</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>The <CODE><FONT face="courier, monospaced">org.apache.xalan.xslt.Process</FONT></CODE> command line now supports XSLTC for transformation. |
| You can use the new <CODE><FONT face="courier, monospaced">-XSLTC</FONT></CODE> option to enable the XSLTC support.</P> |
| <P>The following existing options can be used with -XSLTC:</P> |
| <P><CODE><FONT face="courier, monospaced">-IN, -XSL, -OUT, -V, -EDUMP, -XML, -TEXT, -HTML, -PARAM, <BR> |
| -MEDIA, -FLAVOR, -DIAG, -URIRESOLVER, -ENTITYRESOLVER,<BR> |
| -CONTENTHANDLER</FONT></CODE></P> |
| |
| <P>The following existing options do not work with <CODE><FONT face="courier, monospaced">-XSLTC</FONT></CODE>. If any of them is used |
| with <CODE><FONT face="courier, monospaced">-XSLTC</FONT></CODE>, a message is printed and the option is ignored.</P> |
| <P><CODE><FONT face="courier, monospaced">-QC, -TT, -TG, -TS, -TTC, -TCLASS, -L, -INCREMENTAL, <BR> |
| -NOOPTIMIMIZE, -RL</FONT></CODE></P> |
| |
| <P>We also have a new set of options for <CODE><FONT face="courier, monospaced">-XSLTC</FONT></CODE>. They are all two letter options. The first |
| letter is X and the second letter is the same as the corresponding option in the XSLTC command line |
| <CODE><FONT face="courier, monospaced">org.apache.xalan.xsltc.cmdline.Compile</FONT></CODE>.</P> |
| |
| <P>These new options can only be used with <CODE><FONT face="courier, monospaced">-XSLTC</FONT></CODE>. If any of them is used |
| with Xalan-Java Interpretive, a message is printed and the option is ignored.</P> |
| |
| <P>Here is the list of the new options:</P> |
| <UL> |
| <LI><CODE><FONT face="courier, monospaced">-XO [optional translet_name]</FONT></CODE><BR> |
| Assign the name to the generated translet. If the translet_name is omitted, the translet is |
| generated using the default name (same as the xsl).</LI> |
| <LI><CODE><FONT face="courier, monospaced">-XD destination_directory</FONT></CODE><BR> |
| Specify a destination directory for translet. The generated translet classes will be put |
| under the specified destination directory.</LI> |
| <LI><CODE><FONT face="courier, monospaced">-XJ jar_name</FONT></CODE><BR> |
| Package translet classes into a jar file of name <jar_name></LI> |
| <LI><CODE><FONT face="courier, monospaced">-XP package_name</FONT></CODE><BR> |
| Specify a package name prefix for all generated translet classes</LI> |
| <LI><CODE><FONT face="courier, monospaced">-XN</FONT></CODE><BR> |
| Enable XSL template inlining into one big method</LI> |
| <LI><CODE><FONT face="courier, monospaced">-XX</FONT></CODE><BR> |
| Turn on additional debugging message output</LI> |
| <LI><CODE><FONT face="courier, monospaced">-XT</FONT></CODE><BR> |
| Use translet to transform if possible</LI> |
| </UL> |
| <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 translet name is the same as the name of the Java class that |
| implements the translet. If the name specified by the <CODE><FONT face="courier, monospaced">-XO</FONT></CODE> option |
| or derived from the URL for the stylesheet contains characters that are not |
| permitted in a Java class name, any such character will be replaced with an |
| underscore. For example, if the translet name specified by the <CODE><FONT face="courier, monospaced">-XO</FONT></CODE> |
| option is <CODE><FONT face="courier, monospaced">my-stylesheet</FONT></CODE>, or if the URL of the stylesheet is |
| <CODE><FONT face="courier, monospaced">http://example.org/my-stylesheet.xsl</FONT></CODE>, the translet will actually |
| be named<CODE><FONT face="courier, monospaced">my_stylesheet</FONT></CODE>. |
| </I></FONT></TD></TR></TABLE> |
| </FONT></TD></TR></TABLE><BR> |
| |
| <A name="examples"><!--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>Examples</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>You can just add the <CODE><FONT face="courier, monospaced">-XSLTC</FONT></CODE> option to your existing option list so that it will do |
| the same thing as before, but using XSLTC.</P> |
| |
| <P>Here is a simple example on how to use XSLTC:</P> |
| <P>> <CODE><FONT face="courier, monospaced">java org.apache.xalan.xslt.Process -in test.xml -xsl test.xsl -xsltc</FONT></CODE></P> |
| <P>XSLTC compiles the stylesheet on the fly and uses the bytecode in memory to transform the input xml. |
| No translet class is generated in this simple usage pattern.</P> |
| <P>If you want to generate translet classes from the stylesheet, you can use the <CODE><FONT face="courier, monospaced">-XO</FONT></CODE> option:</P> |
| <P>> <CODE><FONT face="courier, monospaced">java org.apache.xalan.xslt.Process -in test.xml -xsl test.xsl -xsltc -xo</FONT></CODE></P> |
| |
| <P>This example still uses the stylesheet for transformation, but it also generates the |
| translet class "test.class".</P> |
| |
| <P>You can use the <CODE><FONT face="courier, monospaced">-XJ, -XP</FONT></CODE> or <CODE><FONT face="courier, monospaced">-XD</FONT></CODE> options to further customize the translet |
| generation behavior. Translets will be generated if any of the options <CODE><FONT face="courier, monospaced">-XO, -XJ</FONT></CODE> or |
| <CODE><FONT face="courier, monospaced">-XT</FONT></CODE> is used.</P> |
| <P>> <CODE><FONT face="courier, monospaced">java org.apache.xalan.xslt.Process -in test.xml -xsl test.xsl -xsltc -xo newTranslet -xd temp -xp org.apache.test -xj translets.jar</FONT></CODE></P> |
| |
| <P>The above command line uses the xsl for transformation. It also generates translet classes in |
| the name of <CODE><FONT face="courier, monospaced">newTranslet</FONT></CODE>, using a package prefix of <CODE><FONT face="courier, monospaced">org.apache.test</FONT></CODE>, and packages the translets |
| into the jar file <CODE><FONT face="courier, monospaced">translets.jar</FONT></CODE> under the <CODE><FONT face="courier, monospaced">temp</FONT></CODE> directory.</P> |
| |
| <P>All of the examples above use the stylesheet to do the transformation. If the translets are |
| already generated, you can use the <CODE><FONT face="courier, monospaced">-XT</FONT></CODE> option to specify that you want to use the existing translets for transformation. |
| The <CODE><FONT face="courier, monospaced">-XT</FONT></CODE> option has a makefile like feature in that it will compare the timestamps of the translet |
| and the stylesheet. If the translet is newer, it is used for the transformation, otherwise the stylesheet is |
| used and the translet is regenerated.</P> |
| |
| <P>The translet is loaded from the specified destination directory or the current directory, using |
| the specified translet name or the xsl base name, depending on whether the <CODE><FONT face="courier, monospaced">-XD</FONT></CODE> or |
| <CODE><FONT face="courier, monospaced">-XO</FONT></CODE> option is used. The options <CODE><FONT face="courier, monospaced">-XO, -XD, -XP</FONT></CODE> and <CODE><FONT face="courier, monospaced">-XJ</FONT></CODE> |
| can be used with the <CODE><FONT face="courier, monospaced">-XT</FONT></CODE> option to tell XSLTC how to find the translet classes. The translets |
| are directly read in as bytecode. You do not need to add the translet directory or the jar file to your |
| classpath.</P> |
| <P>Example:</P> |
| <P>> <CODE><FONT face="courier, monospaced">java org.apache.xalan.xslt.Process -in test.xml -xsl test.xsl -xsltc -xt -xj translets.jar -xd temp</FONT></CODE></P> |
| |
| <P>This command line will search for the translet <CODE><FONT face="courier, monospaced">test.class</FONT></CODE> inside the jar file <CODE><FONT face="courier, monospaced">temp/translets.jar</FONT></CODE>. If it is |
| found and newer than test.xsl, it is used for the transformation; otherwise the xsl is used and the |
| translet is generated and packaged in the same jar.</P> |
| |
| <P>Here is how the makefile feature for the <CODE><FONT face="courier, monospaced">-XT</FONT></CODE> option works:</P> |
| <OL> |
| <LI>If the xsl does not exist, use the translet</LI> |
| <LI>If the translet does not exist, use the xsl and generate a new translet</LI> |
| <LI>If both exist and the translet is newer, use the translet for transformation</LI> |
| <LI>If both exist and the xsl is newer, use the xsl for transformation and regenerate the translet</LI> |
| </OL> |
| </FONT></TD></TR></TABLE><BR> |
| |
| <A name="faq"><!--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>Simple FAQs</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><B>Q:</B> If I use the <CODE><FONT face="courier, monospaced">-XT</FONT></CODE> option, how can I tell if it is using the translet or the stylesheet for transformation?</P> |
| <P><B>A:</B> Use the <CODE><FONT face="courier, monospaced">-XX</FONT></CODE> option. When XSLTC uses the translet for transformation, you will see a debug |
| message like "Tranform using translet ..." or "Tranform using translet ... from jar file ...".</P> |
| |
| <P><B>Q:</B> I want to use a translet for transformation, and I don't have the stylesheet.</P> |
| <P><B>A:</B> Suppose the translet class is <CODE><FONT face="courier, monospaced">c:\translets\myTranslet.class</FONT></CODE>, you can use the following command line:</P> |
| <P>> <CODE><FONT face="courier, monospaced">java org.apache.xalan.xslt.Process -in test.xml -xsltc -xt -xo myTranslet -xd c:\translets</FONT></CODE></P> |
| <P>If you use <CODE><FONT face="courier, monospaced">-XT</FONT></CODE> option, the <CODE><FONT face="courier, monospaced">-XSL</FONT></CODE> option can be omitted. You have to specify the translet name |
| using the <CODE><FONT face="courier, monospaced">-XO</FONT></CODE> option because there is no default translet name in this situation.</P> |
| |
| <P><B>Q:</B> I only want to compile the stylesheet. I don't want to do a transformation.</P> |
| <P><B>A:</B> JAXP has no notion of compiling a stylesheet. However, you can achieve the same effect by |
| running a dummy transformation and tell XSLTC to save the translet class. Example:</P> |
| <P>> <CODE><FONT face="courier, monospaced">java org.apache.xalan.xslt.Process -xsl test.xsl -xsltc <BR>-xo</FONT></CODE></P> |
| <P>This command runs a transformation on an empty input and generates the translet <CODE><FONT face="courier, monospaced">test.class</FONT></CODE>.</P> |
| </FONT></TD></TR></TABLE><BR> |
| |
| <A name="trax"><!--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>Using options from the JAXP transform APIs</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>You can use some of the attributes in the <CODE><FONT face="courier, monospaced">TransformerFactoryImpl</FONT></CODE> class of XSLTC to |
| customize the translet behaviors from JAXP.</P> |
| |
| <P>Here is the list of attributes in <CODE><FONT face="courier, monospaced">org.apache.xalan.xsltc.trax.TransformerFactoryImpl</FONT></CODE> |
| and their corresponding Process command line options:</P> |
| |
| <TABLE border="0" cellpadding="2" cellspacing="2" width="100%"> |
| <TR> |
| <TD align="left" bgcolor="#a0ddf0" colspan="1" rowspan="1" valign="top"><FONT color="#000000" face="arial,helvetica,sanserif" size="-1"><B>Attributes</B> |
| </FONT></TD> |
| <TD align="left" bgcolor="#a0ddf0" colspan="1" rowspan="1" valign="top"><FONT color="#000000" face="arial,helvetica,sanserif" size="-1"><B>Process command line options</B> |
| </FONT></TD> |
| <TD align="left" bgcolor="#a0ddf0" colspan="1" rowspan="1" valign="top"><FONT color="#000000" face="arial,helvetica,sanserif" size="-1"><B>Default values</B> |
| </FONT></TD> |
| </TR> |
| <TR> |
| <TD align="left" bgcolor="#a0ddf0" colspan="1" rowspan="1" valign="top"><FONT color="#000000" face="arial,helvetica,sanserif" size="-1">translet-name |
| </FONT></TD> |
| <TD align="left" bgcolor="#a0ddf0" colspan="1" rowspan="1" valign="top"><FONT color="#000000" face="arial,helvetica,sanserif" size="-1">-XO |
| </FONT></TD> |
| <TD align="left" bgcolor="#a0ddf0" colspan="1" rowspan="1" valign="top"><FONT color="#000000" face="arial,helvetica,sanserif" size="-1">GregorSamsa |
| </FONT></TD> |
| </TR> |
| <TR> |
| <TD align="left" bgcolor="#a0ddf0" colspan="1" rowspan="1" valign="top"><FONT color="#000000" face="arial,helvetica,sanserif" size="-1">destination-directory |
| </FONT></TD> |
| <TD align="left" bgcolor="#a0ddf0" colspan="1" rowspan="1" valign="top"><FONT color="#000000" face="arial,helvetica,sanserif" size="-1">-XD |
| </FONT></TD> |
| <TD align="left" bgcolor="#a0ddf0" colspan="1" rowspan="1" valign="top"><FONT color="#000000" face="arial,helvetica,sanserif" size="-1">null |
| </FONT></TD> |
| </TR> |
| <TR> |
| <TD align="left" bgcolor="#a0ddf0" colspan="1" rowspan="1" valign="top"><FONT color="#000000" face="arial,helvetica,sanserif" size="-1">package-name |
| </FONT></TD> |
| <TD align="left" bgcolor="#a0ddf0" colspan="1" rowspan="1" valign="top"><FONT color="#000000" face="arial,helvetica,sanserif" size="-1">-XP |
| </FONT></TD> |
| <TD align="left" bgcolor="#a0ddf0" colspan="1" rowspan="1" valign="top"><FONT color="#000000" face="arial,helvetica,sanserif" size="-1">null |
| </FONT></TD> |
| </TR> |
| <TR> |
| <TD align="left" bgcolor="#a0ddf0" colspan="1" rowspan="1" valign="top"><FONT color="#000000" face="arial,helvetica,sanserif" size="-1">jar-name |
| </FONT></TD> |
| <TD align="left" bgcolor="#a0ddf0" colspan="1" rowspan="1" valign="top"><FONT color="#000000" face="arial,helvetica,sanserif" size="-1">-XJ |
| </FONT></TD> |
| <TD align="left" bgcolor="#a0ddf0" colspan="1" rowspan="1" valign="top"><FONT color="#000000" face="arial,helvetica,sanserif" size="-1">null |
| </FONT></TD> |
| </TR> |
| <TR> |
| <TD align="left" bgcolor="#a0ddf0" colspan="1" rowspan="1" valign="top"><FONT color="#000000" face="arial,helvetica,sanserif" size="-1">generate-translet |
| </FONT></TD> |
| <TD align="left" bgcolor="#a0ddf0" colspan="1" rowspan="1" valign="top"><FONT color="#000000" face="arial,helvetica,sanserif" size="-1"> |
| </FONT></TD> |
| <TD align="left" bgcolor="#a0ddf0" colspan="1" rowspan="1" valign="top"><FONT color="#000000" face="arial,helvetica,sanserif" size="-1">false |
| </FONT></TD> |
| </TR> |
| <TR> |
| <TD align="left" bgcolor="#a0ddf0" colspan="1" rowspan="1" valign="top"><FONT color="#000000" face="arial,helvetica,sanserif" size="-1">auto-translet |
| </FONT></TD> |
| <TD align="left" bgcolor="#a0ddf0" colspan="1" rowspan="1" valign="top"><FONT color="#000000" face="arial,helvetica,sanserif" size="-1">-XT |
| </FONT></TD> |
| <TD align="left" bgcolor="#a0ddf0" colspan="1" rowspan="1" valign="top"><FONT color="#000000" face="arial,helvetica,sanserif" size="-1">false |
| </FONT></TD> |
| </TR> |
| <TR> |
| <TD align="left" bgcolor="#a0ddf0" colspan="1" rowspan="1" valign="top"><FONT color="#000000" face="arial,helvetica,sanserif" size="-1">use-classpath |
| </FONT></TD> |
| <TD align="left" bgcolor="#a0ddf0" colspan="1" rowspan="1" valign="top"><FONT color="#000000" face="arial,helvetica,sanserif" size="-1"> |
| </FONT></TD> |
| <TD align="left" bgcolor="#a0ddf0" colspan="1" rowspan="1" valign="top"><FONT color="#000000" face="arial,helvetica,sanserif" size="-1">false |
| </FONT></TD> |
| </TR> |
| <TR> |
| <TD align="left" bgcolor="#a0ddf0" colspan="1" rowspan="1" valign="top"><FONT color="#000000" face="arial,helvetica,sanserif" size="-1">enable-inlining |
| </FONT></TD> |
| <TD align="left" bgcolor="#a0ddf0" colspan="1" rowspan="1" valign="top"><FONT color="#000000" face="arial,helvetica,sanserif" size="-1">-XN |
| </FONT></TD> |
| <TD align="left" bgcolor="#a0ddf0" colspan="1" rowspan="1" valign="top"><FONT color="#000000" face="arial,helvetica,sanserif" size="-1">false |
| </FONT></TD> |
| </TR> |
| <TR> |
| <TD align="left" bgcolor="#a0ddf0" colspan="1" rowspan="1" valign="top"><FONT color="#000000" face="arial,helvetica,sanserif" size="-1">debug |
| </FONT></TD> |
| <TD align="left" bgcolor="#a0ddf0" colspan="1" rowspan="1" valign="top"><FONT color="#000000" face="arial,helvetica,sanserif" size="-1">-XX |
| </FONT></TD> |
| <TD align="left" bgcolor="#a0ddf0" colspan="1" rowspan="1" valign="top"><FONT color="#000000" face="arial,helvetica,sanserif" size="-1">false |
| </FONT></TD> |
| </TR> |
| </TABLE> |
| |
| <P>You can set the attributes using the JAXP interface <CODE><FONT face="courier, monospaced">TransformerFactory.setAttribute(String name, Object value)</FONT></CODE>. |
| The four attributes <CODE><FONT face="courier, monospaced">translet-name, destination-directory, package-name and jar-name</FONT></CODE> are transient. |
| They only apply to the next <CODE><FONT face="courier, monospaced">newTemplates()</FONT></CODE> or <CODE><FONT face="courier, monospaced">newTransformer()</FONT></CODE> call. Their values are reset to |
| the default after the call.</P> |
| |
| <P>The <CODE><FONT face="courier, monospaced">generate-translet</FONT></CODE> attribute does not have a corresponding command line option. This attribute is |
| implied when the <CODE><FONT face="courier, monospaced">-XO</FONT></CODE> or <CODE><FONT face="courier, monospaced">-XJ</FONT></CODE> option is used. The purpose is to make the command line |
| usage syntax a little bit simpler. Setting the <CODE><FONT face="courier, monospaced">generate-attribute</FONT></CODE> attribute to true from JAXP is |
| equivalent to using the <CODE><FONT face="courier, monospaced">-XO</FONT></CODE> option without the optional translet name from the Process command line.</P> |
| |
| <P>If the <CODE><FONT face="courier, monospaced">use-classpath</FONT></CODE> attribute is set to <CODE><FONT face="courier, monospaced">true</FONT></CODE>, the translet will be loaded |
| from the <CODE><FONT face="courier, monospaced">CLASSPATH</FONT></CODE>. This attribute is typically used in a case when the translets are packaged in a |
| prebuilt jar file which is included in the <CODE><FONT face="courier, monospaced">CLASSPATH</FONT></CODE>. You can set the <CODE><FONT face="courier, monospaced">translet-name</FONT></CODE> attribute |
| to indicate which translet to use. If this attribute is not set, the name of the translet is taken from |
| the base name of the stylesheet. The <CODE><FONT face="courier, monospaced">jar-name</FONT></CODE> attribute is not used in this situation.</P> |
| |
| <P>The following example shows you how to do the same thing from JAXP for the question 2 in the FAQ.</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 the system property javax.xml.transform.TransformerFactory in order to use XSLTC |
| String key = "javax.xml.transform.TransformerFactory"; |
| String value = "org.apache.xalan.xsltc.trax.TransformerFactoryImpl"; |
| Properties props = System.getProperties(); |
| props.put(key, value); |
| System.setProperties(props); |
| |
| TransformerFactory tfactory = null; |
| try { |
| tfactory = TransformerFactory.newInstance(); |
| } |
| catch (TransformerFactoryConfigurationError pfe) { pfe.printStackTrace(); } |
| |
| // set the translet name |
| tfactory.setAttribute("translet-name", "myTranslet"); |
| |
| // set the destination directory |
| tfactory.setAttribute("destination-directory", "c:\\translets"); |
| |
| // use the translet for transformation if possible |
| tfactory.setAttribute("auto-translet", "true"); |
| |
| // You can create a Templates object from an empty Source if the translet is specified. |
| Templates templates = tfactory.newTemplates(new StreamSource()); |
| </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> |
| </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="resources/dot.gif" width="1"></TD></TR><TR><TD align="center"><FONT color="#0086b2" size="-1"><I> |
| Copyright © 2006 The Apache Software Foundation. |
| All Rights Reserved. |
| </I></FONT></TD></TR></TABLE></BODY></HTML> |